I have created a cloud service, with MVC Web Role which is working fine on my Local machine, but when i host it on IIS 8, it gives an exception: Value cannot be null. Parameter name: connectionString . The lines on which it is giving the error are as follows
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("DefaultConnectionString"));
Its my company's project, so i won't be able to post any more lines of Code. Hope that you will understand. The method on calling which exception is raised is accessing Azure Table Storage. It is located in a class library project in the same solution. Any help is appreciated.
You have to change the value in your project's app.config file (look in the solution explorer for the file). It should be in the section and be something like:
<add key="DefaultConnectionString" value="some_long_string">
Azure uses different values for local testing and deployment to the cloud, for deployment you need the value that belongs to your company's Azure Storage account.
Or try
using System.Configuration;
...
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
to read the value from app.config without using the CloudConfigurationManager.