我有一个 ASP.NET 核心应用程序,我刚刚升级到 1.1. 此应用程序以前工作正常,我可以发布它(通过 Visual Studio 中的发布命令),它在 IIS 下工作正常。我最近更改了这个 1.1 并让应用程序在调试模式下运行正常。现在,当我发布它时,我得到了
502 - Web server received an invalid response while acting as a gateway or proxy server.
我打开了失败请求跟踪规则,在那里我看到以下内容
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName httpPlatformHandler
Notification EXECUTE_REQUEST_HANDLER
HttpStatus 502
HttpReason Bad Gateway
HttpSubStatus 3
ErrorCode The server is currently disabled. (0x8007053d)
我发布的 web.config 文件看起来像这样
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="httpPlatform" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Cranalytics.dll" forwardWindowsAuthToken="true" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
我的 project.json 文件看起来像这样
{
"dependencies": {
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.Caching.Memory": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Syncfusion.Compression.MVC": "14.2600.0.32-preview2-final",
"Syncfusion.XlsIO.MVC": "14.2600.0.32-preview2-final",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
//"net461": {
// "dependencies": {
// },
// "imports": "dnxcore50"
//}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"appsettings.Production.json",
"appsettings.Staging.json",
"appsettings.json"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
我无法找出配置或 IIS 的问题。
编辑:我对配置进行了一些更改,现在已超过模块加载部分(至少根据跟踪日志)。现在我每次访问网站时都会得到 404。我可以毫无问题地查看静态图像,但当我查看主页到网站时,我收到 404 错误
ModuleName AspNetCoreModule
Notification EXECUTE_REQUEST_HANDLER
HttpStatus 404
HttpReason Not Found
HttpSubStatus 0
ErrorCode The operation completed successfully. (0x0)
我发布的目录结构是 IIS(/Cranalytics)中根网站下的子站点。然后在该文件夹中是所有各种 DLL,以及 web.config。在此目录下是项目的 wwwroot 目录。 IIS 子网站设置为指向根站点(/Cranalytics)。
2 回答
一些帮助的想法。
问题是这个站点正在从 RC1 更新到 1.1. 要让 RC1 工作,我需要撤消一些事情。在我创建网站的 IIS 中,我已经改变了从子网站 Cranalytics 的根到其下面的 wwwroot 的路径。这必须撤消。
然后在配置我需要这样的东西,因为它是一个子网站。这也必须删除。