简体   繁体   中英

Azure Web App. The specified CGI application encountered an error and the server terminated the process

My app works well locally but I've got an error when I deployed it on Azure Web App:

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

My app is a .NET Core 2.0 Web API with no wwwroot folder. I have checked this question , the workaround doesn't work for me and it's about a different .NET Core version. My app creates instance of X509Certificate2 from byte array, I am pretty sure it fails here. I need to dynamically manage X509Certificates - uploading certificate to Web App is not an option.

I also found this in Microsoft Docs :

A known issue with an earlier Kestrel version might cause an ASP.NET Core 1.0 app that's hosted in App Service to intermittently stop responding. You also might see this message: "The specified CGI Application encountered an error and the server terminated the process."

This issue is fixed in Kestrel version 1.0.2. This version is included in the ASP.NET Core 1.0.3 update. To resolve this issue, make sure you update your app dependencies to use Kestrel 1.0.2. Alternatively, you can use one of two workarounds that are described in the blog post ASP.NET Core 1.0 slow perf issues in App Service web apps.

I believe I use latest version of Kestrel dependencies from nuget package:

<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />

I also tried to re-create Web App to make sure there is no junk left and I use everything latest. How can I fix it? Any ideas?

Github issue

I think it might be caused by a missing UseIISIntegration call in your startup code.

Azure Web Apps are based on IIS , so when hosting an ASP.Net Core running with Kestrel , you need this integration to allow IIS to act as a reverse proxy to your service.

Hope it helps!

In Azure App Service it is typically solved by adding a setting:

WEBSITE_LOAD_USER_PROFILE = 1

Some information about it can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM