Settings must be of the form “name=value”. No idea what to do

前端 未结 3 691
名媛妹妹
名媛妹妹 2021-01-17 15:28

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 sta

3条回答
  •  無奈伤痛
    2021-01-17 16:18

    Your "StorageConnectionString" should be in the format of:

    DefaultEndpointsProtocol=[http|https];AccountName=;AccountKey=' as described here

    Also, use CloudConfigurationManagerto obtain your connection string:

    string connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString");

    This gives the added benefit of either using app.config/web.config when your app is running locally or accessing your app setting in azure when running in the cloud. See this link

    Then you should beable to parse the connection string and have the benefit of not having to modify app.config/web.config settings between development & production environments.

提交回复
热议问题