4

I have configured my application to use the Service configuration Local in the development settings.

I have two cscfg files (as per default) Cloud and Local. I have added connection strings for Storage that tell it to use a live account in Cloud.cscfg and dev storage for Local.cscfg.

However when I run my project and use the line

var setting = CloudConfigurationManager.GetSetting("StorageConnectionString");

It is using my Cloud configuration and returning my live storage. It is definitely my Cloud cscfg and not something else setting the value as if I change it in Cloud the setting returned changes.

Is this by design? Is there any way to see the logic CloudConfigurationManager is using to select the configuration?

The weird thing was I am sure this was working earlier.

GraemeMiller
  • 11,973
  • 8
  • 57
  • 111
  • Try to build a small sample that reproduces the problem. Note that it's at the time of launching the compute emulator that the config file is associated with your running app. (So there's nothing in the logic of CloudConfigurationManager that can affect which file is used.) – user94559 Jun 25 '12 at 20:51
  • So by design CloudConfiurationManager is supposed to use the specified Service Configuration? I will see if I can re-produce in a small sample. – GraemeMiller Jun 25 '12 at 21:02

2 Answers2

3

Deleted all compiled versions of projects. Restarted Compute and Development storage services and the issue went away.

GraemeMiller
  • 11,973
  • 8
  • 57
  • 111
  • Sometimes just restarting the Compute Emulator will help. The next step is a complete Clean and Rebuild. With a stackoverflow exception I've been seeing the solution can be a complete machine restart. – Boggin Sep 11 '12 at 08:18
0

Tried deleted all compiled version and restart Emulator many times to no avail.

Found out my setting wasn't right.

So, right click on your Cloud Service project (not the Roles, but the project) and "Properties".

Then go to "Development" tab (from left), and you will see "Service Configuration" setting under "Run/Debug category".

This needs to be Local for Cloud Service project to use Local setting.

stack247
  • 5,579
  • 4
  • 41
  • 64