gpt4 book ai didi

.NET Core 发布到 IIS - HTTP 错误 502.3 - 错误网关 - 指定的 CGI 应用程序遇到错误,服务器终止了进程

转载 作者:行者123 更新时间:2023-12-02 03:08:15 36 4
gpt4 key购买 nike

我正在尝试将我从 RC2 升级到 RTM 的 .NET Core ASP.NET 网站发布到 IIS。

作为健全性检查,我成功地从 Visual Studio 2015 发布了模板/示例“ASP.NET Core Web 应用程序 (.NET Framework)”应用。

但由于某种原因,在发布 RTM 升级的应用程序时,我收到 HTTP 错误 502.3 - 错误网关指定的 CGI 应用程序遇到错误,服务器终止了该进程。

该站点可以在 Visual Studio 中运行 IIS Express。

我该如何调试这个?大家有什么想法吗?

Error 502.3

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=".\MyApp.exe" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>

project.json

{
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"warningsAsErrors": true
},
"dependencies": {
"Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authorization": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Hosting": "1.0.0",
"Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.AspNetCore.Localization": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Routing": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Caching.SqlServer": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",

"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},

"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
},

"frameworks": {
"net461": {}
},

"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
},

"publishOptions": {
"include": [
"wwwroot",
"web.config",
"appsettings.json",
"**/*.cshtml",
"Config/*.json"
]
]
}
}

最佳答案

如果您长时间运行任务,并且网络浏览器在 2 分钟(默认请求时间)内未收到响应,您将收到此错误。因为超时后,IIS 会替换应用程序以“Bad Gateway”响应客户端。

也许您应该更改 web.config 中的请求时间。

system.webServer/aspNetCore 部分中设置 requestTimeout 属性,以指定 ASP.NET Core 模块等待监听 % 的进程响应的持续时间ASPNETCORE_PORT%。

  • requestTimeout 必须仅以整分钟指定,否则默认为 2 分钟。

就像这样:

<system.webServer>
<aspNetCore requestTimeout="00:20:00" ... />
</system.webServer>

关于.NET Core 发布到 IIS - HTTP 错误 502.3 - 错误网关 - 指定的 CGI 应用程序遇到错误,服务器终止了进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39756042/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com