【问题标题】:Asp.Net Core tag in web.config causes failureweb.config 中的 Asp.Net Core 标记导致失败
【发布时间】:2017-10-06 10:13:43
【问题描述】:

我有一个 .NET Core 应用程序,它可以在一台机器上运行,但不能在另一台机器上运行。

问题是应用程序加载失败,因为IIS无法识别以下内容

<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />

结果是当我点击IIS身份验证配置时,出现错误。如果我删除 aspNetCore 标签,我可以查看身份验证设置,但应用程序实际上并没有启动。

在您开始提供关于不要将 web.config 用于 .NET Core 的建议之前,请记住它适用于我的另一台计算机。另外,我需要使用 Windows Security 和 ASP.NET Impersonation。

两台机器都运行 Windows 10 Pro,我检查了以下内容

  • 已安装的 IIS 功能:相同
  • WAS 和 W3SVC:都在本地系统下启动和运行
  • 应用程序池:两者都有 .Net 4.0 CLR,经典模式
  • 文件夹和文件安全性:相同
  • 应用程序和所有 dll 的二进制比较:相同

我通常不使用 IIS 和 .NET,所以我很困惑我的应用程序在两个看似相同的安装之一上中断。我已经没有东西要检查了。任何帮助或指示将不胜感激。

这是完整的web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <authentication mode="Windows" />
    <authorization>
      <deny users="?" />
    </authorization>
    <identity impersonate="true" />
  </system.web>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: a447f5e7-6aee-4d26-bef4-c7111a88c409-->

【问题讨论】:

  • 是否安装了 .NET Core 服务器组件?
  • “.NET Core 服务器组件”是什么意思?我在两台机器上的 IIS 上都启用了“ASP.Net 4.7”。
  • 您需要从microsoft.com/net/download/core#/runtime 下载相关的“Windows Server Hosting (x86/x64)”,安装标准的.NET 是不够的。
  • 我假设运行时将与 Visual Studio (Express) 一起安装 - 因为在 Express 中运行应用程序有效(当我禁用模拟时)。我还是安装了它,但它没有帮助:(
  • VS 使用 IIS Express,所以不需要它。对于 .NET Core,您通常应该使用非托管应用程序池。

标签: iis asp.net-core


【解决方案1】:

我也遇到了同样的问题,这是因为机器 缺少 NET Core Windows Server Hosting 捆绑包。如果未安装,则 IIS 无法识别 web.config 中的 aspNetCore 部分

您可以从以下位置安装捆绑包。

NET Core Windows Server Hosting bundle

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2018-12-22
  • 2021-01-20
  • 2016-11-19
  • 2020-07-18
  • 1970-01-01
  • 2018-10-24
  • 2016-08-02
  • 1970-01-01
相关资源
最近更新 更多