【发布时间】:2017-12-12 08:23:01
【问题描述】:
这是我从 Azure 门户复制的连接字符串:
Server=tcp:xxxxxxxxxxx.database.windows.net,9999;Initial Catalog=DbNameDB;Persist Security Info=False;User ID={my_username};Password={my_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
这是我的 appsettings.json 文件:
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=HeroesDB;Integrated Security=True;MultipleActiveResultSets=True"
}
}
现在我希望我的应用在生产服务器上运行,我该如何设置它?
我应该...
- ...在我的项目中创建一个 appsettings.production.json 文件(在我的 appsettings.json 文件旁边)并将其 DefaultConnectionString 设置为 Azure 服务器的连接字符串?如果我这样做了,Azure 会自动知道要使用这两个文件中的哪一个吗?
- ...将我原来的 appsettings.json 文件的连接字符串更改为 Azure 服务器连接字符串?
- ...寻找完全不同的解决方案?如果是,你有什么建议?
我倾向于解决方案 1.,但我想确定一下。
【问题讨论】:
-
在应用服务中使用连接字符串 - blogs.msdn.microsoft.com/cjaliaga/2016/08/10/…
标签: azure asp.net-core