我有一个使用 VS2013 创建的 C# 工作者角色。这工作了一年多。
我最近将我的 VS 升级到2015版(+ Azure SDK 2.7),现在当我尝试使用 Azure 模拟器模拟我的代码或将此代码上传到云时,我遇到了一个问题:
[fabric] Role Instance: deployment27(109).***.***.0
[fabric] Role state Busy
[runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStopping()
[runtime] Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[fabric] Role state Unhealthy
[fabric] Role state Suspended
[fabric] Role state Busy
[fabric] Role state Unhealthy
[runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStopping()
[runtime] Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStopping()
[runtime] Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[fabric] Role state Busy
[fabric] Role state Suspended
[runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStopping()
[runtime] Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[fabric] Role state Busy
[fabric] Role state Unhealthy
[fabric] Role state Suspended
[fabric] Role state Busy
[runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStopping()
[runtime] Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[runtime] Role entrypoint . CALLING OnStopping()
[runtime] Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
[fabric] Role state Suspended
[fabric] Role state Busy
[fabric] Role state Unhealthy
[fabric] Role state Suspended
[fabric] Role state Busy
您可以在此日志中看到工作人员在启动时遇到了一些问题。因此,启动失败(然后调用 OnStop...)。这个循环永远不会结束。
我试图了解问题出在哪里,但一无所获。我尝试通过在以下位置插入断点来调试代码:Run、RunAsync、OnStart 和 OnStop。这是无奈的,因为这些断点从未在应用程序生命周期中触发。
我在这里读到这个问题在 F# 中是众所周知的,但我没有使用 F#。