【发布时间】:2016-03-16 09:34:46
【问题描述】:
暂存环境未采用正确的连接字符串。
我有三个环境。开发、分期和发布。 我的应用设置如下所示:
{
"Data": {
"DefaultConnection": {
"ConnectionString": "My connection string"
}
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
}
}
我还有两个名为 appsettings.Staging.json 和 appsettings.Release.json 的文件。 在项目属性下,我制作了两个配置文件:Staging 和 Release,它们都有一个 Hosting:环境,其 Value Staging in staging 和 Release in Release。它在 VS 中运行良好,但是当我将它上传到 Azure 时,它总是使用我的 localhost 连接字符串而不是我的在线数据库的默认 appsettings。 我究竟做错了什么?
【问题讨论】:
标签: environment-variables asp.net-core-mvc appsettings