Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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."

like image 209
srivatsa6065 Avatar asked Nov 11 '15 06:11

srivatsa6065


3 Answers

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

like image 105
Damien Pontifex Avatar answered Oct 22 '22 09:10

Damien Pontifex


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=".\logs\stdout"          
        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>
like image 11
Shaun Luttin Avatar answered Oct 22 '22 07:10

Shaun Luttin


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

like image 7
pim Avatar answered Oct 22 '22 08:10

pim