0
votes

I am developing an Azure Cloud Service that contains two separate Worker Roles. I have completed development of the first Worker Role (Role #1) and am now starting development on the second Worker Role (Role #2).

In Role #2 I have a handful of configuration settings defined in the ServiceDefinition.csdef file, including the standard Microsoft.ServiceBus.ConnectionString setting, with corresponding settings in the ServiceConfiguration.Local.cscfg and ServiceConfiguration.Cloud.cscfg files.

My Cloud Services Project is defined as follows:

enter image description here

When I start Role #2 in the local Azure Compute Emulator (Express) all of the Configuration Settings for that role are ignored. Instead, configuration settings are taken from the local App.config file, as shown in the screenshot below:

enter image description here

I am using the CloudConfigurationManager.GetSetting() helper method to retrieve configuration setttings, rather than the depreciated (for Azure) ConfigurationManager.* helpers. For reference, I am using version 2.5 of the Azure SDK.

I don't understand why the configuration settings defined in the ServiceDefinition.csdef and ServiceConfiguration.Local.cscfg are being ignored.

Any advice on this one appreciated as its got me stumped.

1
I believe CloudConfigurationManager.GetSetting() outputs to Trace when probing for a value -- what's there?wgraham
I've updated the question to show Trace outputs.Nick Heppleston
are you sure that the config settings exist under the second role? You'll need to define the config properties in both roles in the service. The line above the highlighted one (Getting ... from ServiceRuntime: FAIL) is showing you that the property doesn't exist in the cscfg for the role. Excluding that, I'm not sure -- double and triple check everything.wgraham
My thinking exactly. I'm ripping out Role #2 now and re-adding to see whether that will make any difference.Nick Heppleston

1 Answers

1
votes

I have managed to resolve this issue after sleeping on the problem! A fresh pair of eyes etc. :-/

It turns out that Role #2 was referencing versions of the NuGet Packages Microsoft.WindowsAzure.ConfigurationManager and WindowsAzure.ServiceBus that were earlier than the versions referenced by Role #1.

Updating these packages in the Worker Role Class Library Project for Role #2 to versions that matched Role #1 has now resolved the issue. Specifically, Microsoft.WindowsAzure.ConfigurationManager was referencing version 1.8.0.0 and was updated to version 2.0.3 to resolve this issue. Role #1 was already referencing version 2.0.3.

For reference, I used the following Package Manager Console command to update the references:

Update-Package Microsoft.WindowsAzure.ConfigurationManager -ProjectName [PROJECT-NAME] -Version 2.0.3