user1503526
user1503526

Reputation: 41

CloudConfigurationManager.GetSetting returning null After publishing

I created a Azure project and used the below code to get the Storage ConnectionString

    CloudConfigurationManager.GetSetting("StorageConnectionString"))

When i executed the project locally, it fetched the ConnectionString and i was able to successfully upload an excel file.

But after publishing the Azure project as a website, the connectionstring was returning null.

I have checked with several solutions like "Checking the version of the Azure SDK...." but everything was ok i hope...

Regards Rajeesh

Upvotes: 2

Views: 1258

Answers (2)

BerndK
BerndK

Reputation: 1080

I had quite similar problems. I updated from Azure SDK 2.0 to 2.2 - during this process I used the NuGet Manager to update the Microsoft.WindowsAzure.Storage to the latest. The PackageManager automatically took Microsoft.WindowsAzure.Configuration to 1.8.0.0. I was not able to get this running (it was for .Net 2.0!?). After I manually set all References to

  • Microsoft.WindowsAzure.Storage 2.1.0.0
  • Microsoft.WindowsAzure.Configuration 2.0.0.0

everything worked.

I think this is because of the way CloudConfigurationManager.GetSetting loads the assembly and calls the funktions (via reflection).

hope this helps.

Upvotes: 4

hhaggan
hhaggan

Reputation: 619

the CloudConfigurationManager.GetSetting("ConnectionString") refers to some values whether for local development or for the windows azure storage account.

if you are running the windows azure project locally, the project will run with no problem because you made him running locally.

if you are looking to make it running on the Cloud here are the steps you should do. 1- double click on the role you have created un the folder roles in the Windows Azure project. this should open the properties page. 2- add setting and name it whatever you like in the code you have entered it was "ConnectionString" for the values click on the left most button of this field, a new window will pop up asking to enter more details for your Windows Azure account. 3- use of the available options whether entering the WIndows Azure storage credentials manually or if you have downloaded the publish settings just import it to the solution.

let me know if this has worked or if you need anything else.

Upvotes: -1

Related Questions