So I'm parsing a connection string for an Azure Storage Account and when I get to the page of the app that uses the connection string, the compiler catches an exception stating, "Settings must be of the form "name=value".
Does this mean that I should correct something in the app.config file where I set the appSettings? If so can you immediately spot something wrong with my format that would cause this exception?
<?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <appSettings>
            <add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey" />
        <appSettings>
    </configuration>
Here's the code for creating an instance of CloudStorage object:
CloudStorageAccount storageaccount = CloudStorageAccount.Parse ("StorageConnectionString");
        CloudTableClient tableClient = storageaccount.CreateCloudTableClient ();
        CloudTable austinBowlingAthletes = tableClient.GetTableReference ("austinBowlingAthletesTable");
Add a reference to System.Configuration.dll and add using System.Configuration; in the file.
Then change your first line to this:
CloudStorageAccount storageaccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
You need to get the value, not just pass the key to Parse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With