Visual Studio 2010 can apply Debug or Release transformations to Web.config, but what about the Azure settings?

前端 未结 5 1211
甜味超标
甜味超标 2020-12-20 00:55

Do I have to manually edit the Azure connection strings myself to switch between production and development, or is there something comparable to the Transformation Visual St

5条回答
  •  伪装坚强ぢ
    2020-12-20 01:08

    You can use CloudConfigurationManager in Azure SDK 1.7 http://msdn.microsoft.com/en-us/LIBRARY/microsoft.windowsazure.cloudconfigurationmanager

    This starts by looking in the ServiceConfiguration.cscfg e.g. ServiceConfiguration.Cloud.cscfg for config setting. If it isn't there it falls back to web.config and app.config

    For example

    CloudConfigurationManager.GetSetting("StorageConnectionString")
    

    Will look in the appropriate cscfgfile for StorageConnectionString setting, then it will search the web.config and then app.config.

提交回复
热议问题