'How can I use the connection string in Azure App Service with Microsoft.Practices.EnterpriseLibrary.Data
Our application use Microsoft.Practices.EnterpriseLibrary.Data, and the connection string is in app.config. We migrate this to an Azure App Service and create 2 environment, Dev and Prod. Dev has Dev database connection string and configure in Azure App Service configuration Prod has Prod database connection string and configure in Azure App Service configuration
I would like to ask how can we implement in the C# code use the connection string in Azure App Service, instead of use app.config
Thank you very much for your support
Solution 1:[1]
Azure App Services have Application settings specifically built to do what you are asking about.
You can use application settings to overwrite your "Settings" inside your appsettings.json file. Those settings can be set specifically for a slot.
You can also use connection strings which are specifically meant to do what you want. Simply create the connection string setting in your appsettings.json file in solution by name (e.g. sqlLiveConnection) and put your testing connection string or no connection string there. Your app service setting will overwrite that setting's value once deployed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Simon Bourdeau |