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

时间:2016-06-21 15:40:24

标签: 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 Core
  •   
  • 通知未知
  •   
  • 处理程序尚未确定
  •   
  • 错误代码0x8007000d
  •   
  • 配置错误
  •   
  • 配置文件\?\ D:\ WebDevelopment \ UAT \ creativeNamePROD \ wwwroot \ web.config
  •   
  • 请求的网址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>

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>

4 个答案:

答案 0 :(得分:49)

我相信我收到了这个错误。我还没有安装.NET核心Windows服务器托管软件包,如instructions like this one中所述。

  

安装.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所说,您可以从this link下载软件包可安装程序。

安装该模块后,我的应用程序已投放(即没有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

答案 1 :(得分:7)

答案 2 :(得分:4)

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

答案 3 :(得分:0)

在Visual Studio Community 2017 v.15.7.1中运行时,我能够解决同样的问题。

必须安装最新的dotnet-sdk-2.1.300-rc1-008673-win-x64。

https://www.microsoft.com/net/download/dotnet-sdk-2.1.300-rc1-windows-x64-installer