【发布时间】:2016-09-05 14:44:57
【问题描述】:
我意识到存在这样的帖子,我已经阅读/重新阅读但仍然遇到问题。大多数都是旧的或没有直接关系,所以我想我会重新发布一个当前的例子。
尝试在 win server 2012 R2 上运行 IIS 8.5+ 的基本站点。此时我卡在“502.3 - Bad Gateway”(错误代码 80070002,模块 httpPlatformHandler,通知 executeRequestHandler,处理程序 httpplatformhandler)
相关信息:
- dnx 1.0.0-rc1-final clr (x64)
- IIS - 已安装/验证 HttpPlatformHandler 1.2 已安装 (v1.2.1959)
- IIS - 设置“无托管代码”池/站点
- 在服务器本身上,如果我从命令行直接运行“kestrel.cmd”(通过 dnu 发布生成)并导航到该站点,则可以显示该站点。
- Project.json:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
},
"commands": {
"kestrel": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": {}
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"www",
"node_modules",
"bower_components"
],
"scripts": {
"prepublish": [
"npm install",
"bower install"
]
}
}
- dnu 发布后生成的 Web.config:
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="approot\kestrel.cmd" arguments="" stdoutLogEnabled="true" stdoutLogFile="logs\stdout.log" forwardWindowsAuthToken="false" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
非常感谢您的帮助。
【问题讨论】:
-
您是否将 wwwroot 和 approot 文件夹复制到 IIS 上的网站文件夹中?您必须复制两个文件夹及其内容,而不是 wwwroot 内容
-
您是否在虚拟目录中托管网站?
-
您的 IIS 站点是如何配置的?默认情况下,您应该有两个文件夹:
wwwroot和approot。 IIS 中的Physical Path应该指向wwwroot目录,其中包含web.config。在这种情况下,httpPlatform中的processPath应该是..\approot\kestrel.cmd。 -
我改变了一些东西,终于让它工作了。不确定哪一张是票,但可能都是组合票。我在我的代码/json 中有一些硬编码的端口,我删除了这些端口(例如 kestrel 命令......)。我从发布中生成的默认命令之一(例如“web”)是使用 WebListener。我将其删除,取而代之的是 Kestrel。我最初将所有内容从 wwwroot 复制到根 web 目录,并相应地更改了生成的 web.config。相反,我现在将 wwwroot 文件留在原处,只是更改了 IIS 中的物理目录。非常感谢您的帮助。
-
我希望我对这个 GitHub 主题的评论有帮助:github.com/aspnet/Hosting/issues/466#issuecomment-168372853
标签: iis asp.net-core dnx kestrel-http-server