0
votes

I am probably missing something obvious with this problem, but i can't seem to get an endpoint deployed as an azure worker role to work in a production environment; it works just fine under the local azure emulator.

Here are the steps i took to duplicate this issue using one of the sample projects that ship with the nservicebus samples:

  1. downloaded samples from the 3.2.8 build.
  2. Used the AzurePubSub example and changed the configuration in the web and worker role to use an actual storage location and not local development storage.
  3. Ran locally using the local compute emulator to verify that the web role and worker role worked as expected.
  4. Deployed to a production environment. web role works and places messages on the queue as expected but the worker role does not handle the message.

there are no exceptions and the worker role deploys and starts as expected; it just doesn't seem to be handling messages.

I am hoping i am missing something simple and someone has come across this problem before.

Update: I see that the below log entry is in the role's event log. Is the problem simply that the default logging profile trying to access 127.0.0.1:10000?

Here is the profile that the sample is configure to use:

NServiceBus.Production NServiceBus.OnAzureTableStorage NServiceBus.WithAzureStorageQueues

And here is the full event log entry:

An unhandled exception occurred. Type: System.Exception Process ID: 2512
Process Name: WaWorkerHost
Thread ID: 6
AppDomain Unhandled Exception for role OrderService_IN_0
Exception: Exception when starting endpoint, error has been logged. Reason: Unable to connect to the remote server
   at NServiceBus.Hosting.GenericHost.Start()
   at NServiceBus.Hosting.Azure.RoleEntryPoint.Run()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<StartRole>b__1()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Inner Exception: Unable to connect to the remote server
   at Microsoft.WindowsAzure.Diagnostics.Management.RoleInstanceDiagnosticManager.<.ctor>b__2(Object sender, ErrorEventArgs args)
   at Microsoft.WindowsAzure.Diagnostics.ControlChannel.GetControlContainer()
   at Microsoft.WindowsAzure.Diagnostics.ControlChannel.set_StartupInfo(DiagnosticMonitorStartupInfo value)
   at Microsoft.WindowsAzure.Diagnostics.Management.RoleInstanceDiagnosticManager..ctor(CloudStorageAccount storageAccount, String deploymentId, String roleName, String roleInstanceId)
   at NServiceBus.Integration.Azure.AzureAppender.ConfigureAzureDiagnostics()
   at NServiceBus.SetLoggingLibrary.Log4Net(Configure config, Object appenderSkeleton)
   at NServiceBus.SetLoggingLibrary.Log4Net[TAppender](Configure config, Action`1 initializeAppender)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at NServiceBus.Hosting.Profiles.ProfileManager.ActivateProfileHandlers()
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at NServiceBus.Configure.Initialize()
   at NServiceBus.Hosting.GenericHost.Start()

Inner Exception: No connection could be made because the target machine actively refused it 127.0.0.1:10000
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

Update - Resolution: The problem was that the sample project that i was using as a baseline used an older connection string identifier name "Diagnostics.ConnectionString" and the NServiceBus Azure Logging Appender was looking for the newer azure identifier that designates diagnostics storage location "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString." Renaming the identifier resolved the issue.

1

1 Answers

0
votes

I'm the author of azure support in nservicebus. Let me help you with figuring this out, something must go wrong and there are a few ways to figure out what.

  1. Log on to the worker using RDP and check the machine event log for any exception originating from your worker process.
  2. Deploy with windows azure diagnostics and check the logs written to table storage
  3. Deploy with intellitrace and download the stack traces from the worker to do a remote debugging session.