【发布时间】:2018-08-18 06:39:26
【问题描述】:
尝试从 IIS 运行我的 ASP.NET core 2.0 Web 应用程序时遇到 HTTP 502.5 错误。
我已经安装了 .NET Core Windows Server Hosting Bundle 并按照本文档https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?tabs=aspnetcore2x检查了我的所有 IIS 设置
web.config 如下所示。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\OscarWeb.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
Windows 事件日志产生以下错误。
它是在 Windows Server 2012 R2 上运行的 IIS v6.2。 Web 应用程序是使用 ASP.NET Core 2.0 构建的。
当我按如下方式从命令行运行 dotnet 时,没有错误:
dotnet oscarweb.dll
【问题讨论】:
-
安装托管包后是否重启了机器?
-
我会试试看的。我们有用户在服务器上使用其他应用程序,因此需要在每个人都回家后重新启动。
-
好吧,如果您不能/不想完全重启,您至少必须完全停止 IIS 服务(iisreset 还不够)。不记得我头顶上的命令,但应该很容易找到。但是,在 IIS 可以实际使用托管包安装的模块之前,必须发生其中的一个。
-
This github issue 表示 0x80070002 错误意味着“找不到文件”(“文件”可能丢失或 IIS 没有权限)。另外,请检查此issue on github >
the sites were in a non-standard location and IIS did not have read rights to that folder. Changing the application pool to run as Administrator helps。 -
@ChrisPratt 在周末重新启动后,您的建议已经奏效。 ASP.NET Core 2.0 应用程序现在可以完美运行。感谢您的建议。
标签: iis asp.net-core windows-server-2012-r2