【发布时间】:2017-08-16 18:52:20
【问题描述】:
我刚刚在处理 ASP.NET Core 1.1.1 项目时更新了我的 Visual Studio。在更新之前,我对 Azure 的持续交付工作得非常好。现在我在部署后查看 Web 应用程序时收到错误消息。在根位置找不到 appsettings.json:
The configuration file 'appsettings.json' was not found and is not optional. The physical path is 'D:\home\site\wwwroot\appsettings.json'.
它现在正在 wwwroot 文件夹中寻找文件。这不是它在更新之前寻找的基本路径。我没有更新到 ASP.NET Core 2.0。
我的配置生成器如下所示:
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
appsettings.json 文件应该被移动还是这里发生了什么?
【问题讨论】:
标签: c# asp.net-core