C# 在服务器上发布我的Core 2.2项目后,web.config无效
我有一个在Asp.NETCore2.2框架上使用C#编写的项目 我可以把它发布到我的副总裁那里。但是,当我尝试访问该网站时,我得到以下错误 HTTP错误500.19-内部服务器错误 无法访问请求的页面,因为该页面的相关配置数据无效 下面是位于根目录中的web.config文件的内容C# 在服务器上发布我的Core 2.2项目后,web.config无效,c#,asp.net-core,asp.net-core-2.2,C#,Asp.net Core,Asp.net Core 2.2,我有一个在Asp.NETCore2.2框架上使用C#编写的项目 我可以把它发布到我的副总裁那里。但是,当我尝试访问该网站时,我得到以下错误 HTTP错误500.19-内部服务器错误 无法访问请求的页面,因为该页面的相关配置数据无效 下面是位于根目录中的web.config文件的内容 <?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApp
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\ProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 47b26df0-8a01-4d75-9549-3a98654550a3-->
O使用浏览器对浏览器进行切换,效果良好
但是,当我使用域名访问它时,仍然会得到Http错误500.19,如上所述 如评论中所述
在iis中安装AspnetCore模块
将ASPNETCORE_环境设置为您环境中的生产环境,或
安装在
是否将web.config
文件复制到输出目录?@swdon是的。事实上,我可以使用命令行启动项目。我将用解释更新我的问题。请发布服务器端日志以说明此错误。您的目标是.net core还是.net framework?如果删除
元素会发生什么?它似乎在生产中使用appsettings.developement.json而不是appsettings.production.json。知道为什么吗?@MikeA我会在startup.cs中查看您是如何引导配置的我不会做任何额外的事情来引导特定的设置文件。据我所知,应用程序应根据环境名称自动加载正确的设置是。谢谢你的帮助
<aspNetCore processPath="dotnet"
arguments=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile="\\?\%home%\LogFiles\stdout"
hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>