Reputation: 15276
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:
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.
Upvotes: 4
Views: 3651
Reputation: 17264
I got this after upgrading Azure SDK from 2.0 to 2.2. I was able to fix by:
Upvotes: 1
Reputation: 1195
I had the same problem. I had updated the project to use Azure SDK 2.0. I updated NuGet packages for my web and worker roles, but the Azure project in Visual Studio was still on the old version.
To fix this, Right-Click on your Azure project and select Properties. Under the Application tab, you'll see a button to Update your Azure SDK.
Upvotes: 1
Reputation: 15276
I've fixed it, the following steps solved it:
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?)Microsoft.WindowsAzure.Configuration
osFamily
from 1 to 2 (Windows 2008 SP2 -> Windows 2008 R2)Some steps are probably unnecessary but I'm not sure which of them :-)
Upvotes: 4
Reputation: 460
How about using RoleEnvironment.GetConfigurationSettingValue("ConnectionString") instead; assuming you are trying to get a value from service configuration file (cscfg) ?
Upvotes: 1