.NET Core 发布到 IIS - HTTP 错误 502.3 - 错误网关 - 指定的 CGI 应用程序遇到错误并且服务器终止了该进程 [英] .NET Core publish to IIS - HTTP Error 502.3 - Bad Gateway - The specified CGI application encountered an error and the server terminated the process

查看:105
本文介绍了.NET Core 发布到 IIS - HTTP 错误 502.3 - 错误网关 - 指定的 CGI 应用程序遇到错误并且服务器终止了该进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

作为健全性检查,我成功发布了来自 Visual Studio 2015 的模板/示例ASP.NET Core Web 应用程序 (.NET Framework)"应用程序.

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

该站点可以从 Visual Studio 运行 IIS Express.

我该如何调试?有人有什么想法吗?

<块引用>

web.config

</处理程序><aspNetCore processPath=".MyApp.exe" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".logsstdout"/></system.webServer></配置>

project.json

<代码>{构建选项":{emitEntryPoint":真,保留编译上下文":真,"warningsAsErrors": 真},依赖关系":{"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",类型":构建"},"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"},构架": {net461":{}},工具": {"BundlerMinifier.Core": "2.0.238","Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final","Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"},脚本":{"prepublish": [ "bower install", "dotnet bundle" ],"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"},发布选项":{包括": ["wwwroot","web.config","appsettings.json","**/*.cshtml",配置/*.json"]]}}

解决方案

我该如何调试?谁有想法?

这里有三个想法:

  1. I'm trying to publish to IIS a .NET Core ASP.NET Website I upgraded from RC2 to RTM.

    As a sanity check, I was successfully able to publish the template/sample "ASP.NET Core Web Application (.NET Framework)" app from Visual Studio 2015.

    But for some reason, when publishing the RTM upgraded app, I'm getting HTTP Error 502.3 - Bad Gateway The specified CGI application encountered an error and the server terminated the process.

    The site DOES work running IIS Express from Visual Studio.

    How can I debug this? Anyone have any ideas?

    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=".logsstdout" />
      </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"
        ]
      ]
     }
    }
    

    解决方案

    How can I debug this? Anyone have any ideas?

    Here are three ideas:

    1. Read this and make sure that you have covered all that it says.

    2. Run the published .MyApp.exe from the command line. Does that work?

      • If it does, you know you have an IIS integration problem.
      • If it does not, you know you have an application problem.
    3. Change stdoutLogEnabled="false" to true and then check the logs at stdoutLogFile=".logsstdout". The error(s) there might tell you something.

    4. Check your IIS Application logs in the Event Viewer. The error(s) there might tell you something.

    Event Viewer Application Logs

    这篇关于.NET Core 发布到 IIS - HTTP 错误 502.3 - 错误网关 - 指定的 CGI 应用程序遇到错误并且服务器终止了该进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆