如何使用microsoft.practices.enterpriselibrary.data中的Azure App Service中的连接字符串使用
我们的应用程序使用microsoft.practices.enterpriselibrary.data,并且连接字符串在app.config中。 我们将其迁移到Azure应用程序服务,并创建2个环境,开发和产品。 Dev具有Dev Database Connection字符串和Azure App Service配置中的配置 POD在Azure App Service配置中具有产品数据库连接字符串和配置,
我想问我们如何在C#代码中实现使用Azure App Service中的连接字符串,而不是使用App.Config。
非常感谢您的支持
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Azure App Services的应用程序设置专门为完成您的要求而构建。
您可以使用应用程序设置来覆盖AppSettings.json文件中的“设置”。这些设置可以专门为插槽设置。
您还可以使用专门用于完成您想要的事情的连接字符串。只需在appsettings.json文件中创建连接字符串设置,按名称(例如sqlliveconnection)在解决方案中创建“连接”文件,然后将测试连接字符串或没有连接字符串放置。部署后,您的应用服务设置将覆盖该设置的值。
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.