Nick Heppleston
Nick Heppleston

Reputation: 1973

Azure Worker Role Ignoring ServiceConfiguration.Local Configuration

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.

Upvotes: 0

Views: 503

Answers (1)

Nick Heppleston
Nick Heppleston

Reputation: 1973

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

Upvotes: 1

Related Questions