指定的CGI应用程序遇到错误,服务器终止了该进程

sri*_*065 25 asp.net azure asp.net-core

我在azure上托管一个asp.net 5应用程序,代码是针对beta8编译的,应用程序在本地环境中运行良好,当我在azure网站上发布代码时.我得到一个常见错误"指定的CGI应用程序遇到错误,服务器终止了该过程."

Dam*_*fex 9

我能够通过forwardWindowsAuthToken从wwwroot下的web.config文件中删除来解决这个问题.

  1. 导航到src/ProjectName/wwwroot
  2. 打开web.config
  3. httpPlatform删除forwardWindowsAuthToken="true/false"属性

重新部署和我的工作正常.

请参阅https://github.com/aspnet/Hosting/issues/364以进行大量讨论


Sha*_*tin 9

简答

对我们来说,修复是来UseIISIntegration()WebHostBuilder.

public static void Main(string[] args)
{
    var host = new WebHostBuilder()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseKestrel()
        .UseIISIntegration() // Necessary for Azure.
        .UseStartup<Program>()
        .Build();

     host.Run();
}
Run Code Online (Sandbox Code Playgroud)

更多细节

我们的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="%LAUNCHER_PATH%"  
        arguments="%LAUNCHER_ARGS%"            
        stdoutLogEnabled="false"               
        stdoutLogFile=".\logs\stdout"          
        forwardWindowsAuthToken="false"/>      
</system.webServer>                            
</configuration>       
Run Code Online (Sandbox Code Playgroud)

我们的project.json看起来像这样:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*"
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },
  "frameworks": {
    "netcoreapp1.0": {}
  },
  "buildOptions": {
    "emitEntryPoint": true
  },
  "publishOptions": {
    "include": [
      "web.config"
    ]
  },
  "scripts": {
    "postpublish": [
      "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我们的nuget.config看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>
Run Code Online (Sandbox Code Playgroud)


rob*_*pim 7

如果您的代码中存在无限循环,也会发生这种情况。


Mar*_*ndl 5

我最近遇到了同样的问题,并且能够通过在web.configrequestTimeout中设置来解决它:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\PROJECT.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" requestTimeout="00:30:00"/>
    </system.webServer>
  </location>
</configuration>
Run Code Online (Sandbox Code Playgroud)