CloudConfigurationManager.GetSetting returns empty string in production?

azure, c#

Solution

I've fixed it, the following steps solved it:

- One of the projects referenced `Microsoft.WindowsAzure.Configuration` version 1.7.0.0. Changed this (strange if this is the cause though since the dll in the output where the correct version. Maybe it was loaded from GAC at runtime?)

- Removed assembly binding redirects for `Microsoft.WindowsAzure.Configuration`

- Upgraded the `osFamily` from 1 to 2 (Windows 2008 SP2 -> Windows 2008 R2)

Some steps are probably unnecessary but I'm not sure which of them :-)

Problem

I've just upgraded my project to Azure Tools 1.8 (October 2012 SDK) and I'm running into a strange issue; In my WorkerRole my calls to `CloudConfigurationManager.GetSetting` returns null (can be empty string, hard to tell from log file). In other words; I can't fetch settings from the RoleEnvironment. Info: - Emulator/localhost works perfect - Verified dll-version via RDP - Tried to fetch various testsettings - The same lines of code is running just fine in the production slot right now. - I'm using Microsoft.WindowsAzure.ConfigurationManager 1.8.0.0 from nuget - Added setting to app.config also to test, same result. Any clues? Update: Calling code (method Run() in WorkerRole) ``` public override void Run(){ // Fetch connectionstring var connectionString = CloudConfigurationManager.GetSetting("ConnectionString"); // connectionString is null here? [...] } ``` The setting is visible in the portal so it is certainly deployed.

Original source