2017-08-16 26 views
0

我刚刚更新了我的Visual Studio对ASP.NET核心1.1.1项目时。在更新之前,我连续传递到Azure的工作非常好。现在,我在部署后查看Web App时收到错误消息。它是无法找到appsettings.json在根位置:Azure的Web应用程序失败的Visual Studio更新后定位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 2.0的核心。

我configurationbuilder看起来是这样的:

var builder = new ConfigurationBuilder() 
       .SetBasePath(env.ContentRootPath) 
       .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) 
       .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); 

应该是移动或这里发生了什么的appsettings.json文件?

回答

1

在Azure中,wwwroot也是所有DLL和app.config中放置您的应用程序的“基本路径”的名称。您网站的“wwwroot的”(与图片,脚本等)的子文件夹,就像D:\home\site\wwwroot\wwwroot。您可以使用Kudu轻松检查。

仔细检查更新后对文件的更改,尝试在本地运行dotnet publish - 可能在.csproj文件中更改了某些内容,并且applications.json不再发布。

相关问题