IIS服务器和ASP.Net核心 - 页面无法访问,因为页面的相关配置数据无效

and*_*dre 38 c# asp.net web-config iis-7.5

当我尝试使用IIS Server v7.5启动我的ASP.Net核心应用程序时出现以下错误...我已成功将网站(Visual Studio中的文件系统选项)发布到特定目录.它从approot/web.cmd文件启动正常.但是,当我尝试将其连接到IIS服务器并将其指向wwwroot文件夹时,我收到以下错误:

HTTP错误500.19 - 内部服务器错误

无法访问请求的页面,因为页面的相关配置数据无效.

  • 详细的错误信息
  • 模块IIS Web核心
  • 通知未知
  • 处理程序尚未确定
  • 错误代码0x8007000d
  • 配置错误
  • 配置文件\?\ D:\ WebDevelopment\UAT\creativeNamePROD\wwwroot\web.config
  • 请求的URL http://10.2.177.226:59/
  • 物理路径
  • 登录方法尚未确定
  • 登录用户尚未确定
  • 请求跟踪日志目录失败

下面是我试过的两个不同的web.config文件.当我尝试进入IIS中的配置编辑器时,我也会得到一个不明确的错误.任何帮助将不胜感激!!!

<configuration>
<system.web>
  <httpRuntime maxQueryStringLength="64768" maxUrlLength="65536" />
</system.web>
<system.webServer>
<security>
  <requestFiltering>
    <requestLimits maxQueryString="64768" />
  </requestFiltering>
</security>
<handlers>
  <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

Web.config#2 - 设置相同的错误

<configuration>
  <system.webServer>
    <handlers>
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

The*_*Pea 62

我相信我收到了这个错误.我还没有安装.NET Core Windows Server Hosting软件包,如同这样的说明中所述.

安装.NET Core Hosting Bundle

在托管系统上安装.NET Core Hosting Bundle.该软件包安装.NET Core Runtime,.NET核心库和ASP.NET核心模块.该模块在IIS和Kestrel服务器之间创建反向代理.如果系统没有Internet连接,请在安装.NET Core Hosting Bundle之前获取并安装Microsoft Visual C++ 2015 Redistributable.

正如@Patrick所说,您可以从此链接下载软件包可安装程序.

安装该模块后,我的应用程序服务(即没有500错误).

我看到@Jørgen已经对OP做了这个评论,所以他得到了信任:

您是否安装了.NET Core Windows Server Hosting捆绑包?这需要IIS作为.net核心库的反向代理.你会在这篇文章中找到链接:docs.microsoft.com/en-us/aspnet/core/publishing/iis我在开发机器上安装它之前遇到了同样的问题. - JørgenTvedt3月28日6:31

  • 太棒了!救生员!!即使安装了.net core 2.1托管,但仅安装了2.2 sdk,但没有安装.net core 2.2托管,也是如此。谢谢!! (2认同)
  • 就我而言,我安装了_Runtime Bundle_而不是_Hosting Bundle_。安装托管捆绑包后,它就可以工作了。不知道它们是两个不同的东西。 (2认同)

Dal*_*ton 4

这对我有用,删除文件:project.lock.json并运行dotnet restore, restart visual studio