0
votes

About a year ago I was able to get NSB standing up and working great on Azure in a WorkerRole. We implemented a few services. It took some work, there were several issues revolving around dependencies and versions however after much tweaking, we got things up and running.

So fast forward to today, new product, trying to stand up a simple example, proof of concept in an exploration phase with NSB v4.0 for a system we are building. I wanted to stand up the AzurePubSub example located here; https://github.com/Particular/NServiceBus.Azure/tree/develop/IntegrationTests/AzurePubSub

Having a heck of a time just getting the sample to run. I have documented out the steps I have taken;

Using VS 2k12, NSB 4.0 (latest stable)

  1. Open AzurePubSub project
  2. Prompted to Convert the project to target Windows Azure Tools - v2.1 (converted)
  3. Drop NSB ref from MyMessages, replaced with Nuget NServiceBus.Interfaces pkg
  4. Clean Build on MyMessages
  5. OrderService, dropped NServiceBus, NServiceBus.Core, NServiceBus.Azure, NServiceBus.Hosting.Azure, Common.Logging
  6. OrderService, replaced above with NuGet package (NServiceBus.Hosting.Azure).

  7. OrderWebsite dropped NServiceBus, NServiceBus.Azure, NServiceBus.Core , Common.Logging

  8. OrderWebsite, replaced above with NuGet package (NServiceBus.Azure).

  9. Achieved a clean Solution Build!

  10. Debug

Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

  1. Added Binding Redirects to OrderWebsite manually (optionally could ref NuGet for Diagnostics)

    1. Debug

    Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    1. Added Binding Redirects to OrderService manually (optionally could ref NuGet for Diagnostics)

    2. Debug

    Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    1. Dropped Microsoft.WindowsAzure.Diagnostics Reference 2.0.0.0
    2. Added Microsoft.WindowsAzure.Diagnostics Reference to 2.1.0.0 (file version 2.1.6493.0) to both OrderService and OrderWebsite (left binding redirects in)

    3. Debug OrderWebsite loads up nicely. OrderService get caught in a loop Starting and stopping seen via the Azure Compute Emulator. EndpointConfiguration ctor never gets called, nor the DefineRouting class IProvideConfiguration implementation.

    Azure Compute Emulator ouput:

[fabric] Role Instance: deployment21(119).AzureService.OrderService.0 [fabric] Role state Unhealthy [Diagnostics]: UpdateState(Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorStartupInfo, Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration, ) [Diagnostics]: Acquired mutex [Diagnostics] Information: C:\Users\Ryan\AppData\Local\dftmp\Resources\a903dc1b-98a5-4a78-b04d-c533e881564d\directory\DiagnosticStore\Monitor [Diagnostics] Information: D:\GitHub\NServiceBus.Azure\IntegrationTests\AzurePubSub\csx\Debug\roles\OrderService\diagnostics\x64\monitor\MonAgentHost.exe -LocalPath "C:\Users\Ryan\AppData\Local\dftmp\Resources\a903dc1b-98a5-4a78-b04d-c533e881564d\directory\DiagnosticStore\Monitor" -StaticConfigFile "C:\Users\Ryan\AppData\Local\dftmp\Resources\a903dc1b-98a5-4a78-b04d-c533e881564d\directory\DiagnosticStore\Monitor\Configuration\mastaticconfig.xml" -ConfigFile "C:\Users\Ryan\AppData\Local\dftmp\Resources\a903dc1b-98a5-4a78-b04d-c533e881564d\directory\DiagnosticStore\Monitor\Configuration\maconfig.xml" -ShutDownEvent WADDM-ShutDown-81011d9e243b47bc8941b805e7146ce3 -InitializedEvent WADM-StartUp-81011d9e243b47bc8941b805e7146ce3 -parent 5704 -events [fabric] Role state Stopping [Diagnostics]: Creating config channel server [MonAgentHost] Output: Agent will exit when WADDM-ShutDown-81011d9e243b47bc8941b805e7146ce3 is signaled. [MonAgentHost] Output: Will signal WADM-StartUp-81011d9e243b47bc8941b805e7146ce3 after the agent is initialized. [MonAgentHost] Output: Registered as an event consumer. [MonAgentHost] Output: Agent will exit when parent process 5704 exits. [MonAgentHost] Output: Monitoring Agent Started [Diagnostics]: Starting configuration channel polling [runtime] Role entrypoint . CALLING OnStart() [runtime] Role entrypoint . COMPLETED OnStart() [runtime] Role entrypoint . CALLING Run() [runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED [runtime] Role instance recycling is starting [runtime] Role entrypoint . CALLING OnStop() [runtime] Role entrypoint . COMPLETED OnStop() [fabric] Role state Busy

And this is where it loops over and over again. Error is obviously happening on initializing things with the Worker Role for the OrderService, however I can't seem to located just what is going wrong.

Anyone have any ideas on how I can pinpoint the cause?

Many thanks, Ryan

2

2 Answers

0
votes

Indeed this has to do with an incompatibility between the visual studio tooling version (2.1) and the references that nservicebus 4.0 has to ServiceRuntime and Diagnostics assemblies (2.0). At runtime they need to match or you will see weird behavior when deploying as you mention.

You can solve this problem in 2 ways, use VS tooling 2.0 (There should be a switch somewhere on your project properties), or reference the latest build of NServicebus.Azure 4.1. If all goes well we should be able to release this new version soon.

I am also painfully aware that this compatibility issue is going to haunt us for future versions as well, so I'm looking to decouple nservicebus from the specific windows azure sdk version in the future. Here is the github issue if you want to follow progress on that one. https://github.com/Particular/NServiceBus.Azure/issues/26

0
votes

Latest stable NServiceBus.Azure works with Azure SDK 2.0. I would strongly recommend using 2.0 instead, you can have both 2.0 and 2.1 on the same development machine.

I would also build NSB and NSB.Azure from source code and debug the Azure transport initialization. There were several issues there, which Yves already fixed but I am not sure is this has been released. I don't know your configuration and can't really say anything there but if you get for example incorrect queue name, it will just silently fail.