我有一个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)。
答案 0 :(得分:0)
一些帮助的想法。
1.Check Directory Browsing of your website if it is in enable state or not.
2.Try to separate your project to a new website with different port.
-also configure the newly created web site of course.
3.framework in application pool vs project, it must be the same.
答案 1 :(得分:0)
问题是该网站正在从RC1更新到1.1。要让RC1工作,我需要撤消一些事情。在我创建网站的IIS中,我已经改变了从子网站Cranalytics的根到其下面的wwwroot的路径。这必须撤消。
然后在配置中我需要这样的东西,因为它是一个子网站。这也必须删除。
//if (env.IsDevelopment())
//{
// Configure1(app, env, loggerFactory, context);
//}
//else
//{
// app.Map("/Cranalytics", app1 => Configure1(app1, env, loggerFactory, context));
//}