The specified CGI application encountered an error and the server terminated the process

I am hosting a asp.net 5 application on azure, the code is complied for beta8, the application runs fine on the local environment and when i publish the code on the azure site. i get a common error “The specified CGI application encountered an error and the server terminated the process.”

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I was able to solve this issue by removing forwardWindowsAuthToken from the web.config file under wwwroot.

  1. Navigate to src/ProjectName/wwwroot
  2. Open the web.config
  3. In the httpPlatformremove the forwardWindowsAuthToken="true/false" property

Redeploy and mine worked fine.

See here https://github.com/aspnet/Hosting/issues/364 for plenty of discussion

Method 2

Short Answer

For us the fix was to to UseIISIntegration() on the WebHostBuilder.

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

     host.Run();
}

More Details

Our web.config looks like this:

<?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=".logsstdout"          
        forwardWindowsAuthToken="false"/>      
</system.webServer>                            
</configuration>

Our project.json looks like this:
{
  "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%"
    ]
  }
}

Our nuget.config looks like this:
<?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>

Method 3

This can also happen if you have an infinite loop in your code.

Method 4

I recently had the same issue and was able to solve it by setting the requestTimeout within the web.config:

<?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=".logsstdout" requestTimeout="00:30:00"/>
    </system.webServer>
  </location>
</configuration>

Method 5

I just ran into this error whilst deploying an ASP.core app using .NET 5.4.2. The fix was to deploy to a fresh app service instance. My guess was that there was some junk left lying around from a previous deployment which used a different framework version.

Method 6

I was facing the same issue following are steps how I resolved.

  • My application was .NET CORE 2.2 and I was deploying in the Azure web app.
  • Right Click on the project and click on the publish button.
  • Select the publish profile which you downloaded from Azure.
  • Next, change the deployment mode under Summary to Self-Contained.
  • Now click on publish button it should work.
    enter image description here

Method 7

I have this problem in the azure app service, since the version of asp.net core is preview version, so I update the asp.net core version by NuGet to 2.0.1 and redeploy the app.

The app works again.

Method 8

I’m using .NET Core 2.1 and EF Core deployed to an Azure web app. I got this error when I switched from using a database account with db owner rights to a limited database account. I suspect EF needs a right I’m missing when the app starts.

Method 9

I got the same error. After searching some solutions, I changed the code, replacing the async method calls with non-async ones, regarding the notes that thread pool might exceed the allowed capacity. This did not work. Then I increased the request timeout in web.config to 20 minutes and it is resolved.

Add the string below in web.config file.

requestTimeout="00:20:00"

as
<aspNetCore processPath="dotnet" arguments=".API.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" requestTimeout="00:20:00" />

Method 10

Today we had the same problem. In our case it was caused by a failing Debug.Assert(...).

Method 11

For us its not related with code, appservice redeploy and then restart needs to be done


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x