I am having some trouble deploying my service into the cloud. More accurately using NServiceBus with Azure. I have retraced my steps 3 times (created the same project 3 times over) with the same results so I am really hoping somebody can point me in the right direction.
UPDATE -> 24/02/2014
Downgraded assemblies mentioned in post to version 5.1.3 and deployment now works fine and queues are created. Perhaps there is something in the latest version that is causing deployment to fail.
Firstly, I create my prerequisites using the Portal:
- Cloud Service entitled Discount
- Storage Account entitled discount
- Service Bus entitled discountbus
All 3 above were created using Quick Create.
Back in Visual Studio, created:
- New Solution entitled AzureTest
- New Cloud Service Project entitled AzureTest
- New Worker Role project entitled Discount
Made references to the following assemblies via nuget:
- NServiceBus 5.2.0
- NServiceBus.Azure 6.2.0
- NServiceBus.Hosting.Azure 6.2.0
- NServiceBus.Azure.Transports.WindowsAzureServiceBus 6.2.0
Added a new assembly entitled Messages which will contain my commands and events to be published.
Changed the setting in my cloud service project (AzureTest) to be so that I can get some logging:
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"/>
My EndpointConfig looks like:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Worker
{
public void Customize(BusConfiguration configuration)
{
// Nothing too complicated for now, just anything where the namespace contains commands or events
configuration.Conventions().DefiningCommandsAs(x => x.AssemblyQualifiedName != null && x.AssemblyQualifiedName.Contains(".Commands."));
configuration.Conventions().DefiningEventsAs(x => x.AssemblyQualifiedName != null && x.AssemblyQualifiedName.Contains(".Events."));
configuration.UseTransport<AzureServiceBusTransport>();
configuration.UsePersistence<AzureStoragePersistence>();
// Docs don't state to do this however logs show this is required
configuration.DisableFeature<TimeoutManager>();
configuration.DisableFeature<SecondLevelRetries>();
configuration.DisableFeature<Sagas>();
}
}
WorkerRole simply attempts to start and stop the NServiceBusRole:
public class WorkerRole : RoleEntryPoint
{
private NServiceBusRoleEntrypoint nsb = new NServiceBusRoleEntrypoint();
public override bool OnStart()
{
Trace.TraceInformation("Discount has been started");
nsb.Start();
return base.OnStart();
}
public override void OnStop()
{
Trace.TraceInformation("Discount has stopped");
nsb.Stop();
base.OnStop();
}
}
ServiceConfiguration.Cloudcscfg contains:
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=discount;AccountKey=[my key]" />
</ConfigurationSettings>
Config section for NSB:
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
<TransportConfig MaximumConcurrencyLevel="5" MaxRetries="2" MaximumMessageThroughputPerSecond="0" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Assembly="Messages" Type="Messages.Commands.TestCommand" Endpoint="Discount" />
</MessageEndpointMappings>
</UnicastBusConfig>
<connectionStrings>
<add name="NServiceBus/Transport" connectionString="Endpoint=sb://discountbus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=[my key]" />
</connectionStrings>
When I attempt to deploy via right clicking cloud service project and publish I get the following feedback:
09:34:29 - Applying Diagnostics extension.
09:34:50 - Preparing deployment for AzureTest - 24/02/2015 09:34:20 with Subscription ID 'e3dbff72-f1c1-43c8-b052-3404ea5c168e' using Service Management URL 'https://management.core.windows.net/'...
09:34:50 - Connecting...
09:34:50 - Verifying storage account 'discount'...
09:34:50 - Uploading Package...
09:34:56 - Creating...
09:35:28 - Created Deployment ID: e464ba5932fc402faf6945e8a983b52e.
09:35:28 - Instance 0 of role Discount is stopped
09:35:28 - Starting...
09:35:45 - Initializing...
09:35:45 - Instance 0 of role Discount is in an unknown state
09:36:18 - Instance 0 of role Discount is creating the virtual machine
09:37:23 - Instance 0 of role Discount is starting the virtual machine
09:39:33 - Instance 0 of role Discount is in an unknown state
09:40:06 - Instance 0 of role Discount is busy
Details: Preparing to start role... System is initializing. [2015-02-24T09:39:43Z]
09:42:10 - Instance 0 of role Discount is restarting Details: Role has encountered an error and has stopped. System was initialized successfully. [2015-02-24T09:41:57Z]
09:44:14 - Instance 0 of role Discount is busy Details: Recovering role... System was in
Tried debugging this locally too with the cloud service project set as start up but get an error stating:
"An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in WaWorkerHost.exe." Unfortunately no further details are provided.
Server Explorer shows my storage but with only the Metrics Tables showing.
Hoping someone can show me the light and direct me where I have gone wrong. Gotten quite emotional with all this now and been trying to do this simple project for almost 3 days :(
Cheers, DS.