c# - Azure Web 应用程序。指定的 CGI 应用程序遇到错误,服务器终止了该进程

标签 c# asp.net azure asp.net-core azure-web-app-service

我的应用程序在本地运行良好,但当我将其部署到 Azure Web App 上时出现错误:

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

我的应用程序是一个 .NET Core 2.0 Web API,没有 wwwroot 文件夹。我查过this question ,该解决方法对我不起作用,它与不同的 .NET Core 版本有关。我的应用程序从字节数组创建 X509Certificate2 实例,我很确定它在这里失败。我需要动态管理 X509Certificates - 无法将证书上传到 Web 应用程序。

我还在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.

我相信我使用 nuget 包中最新版本的 Kestrel 依赖项:

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

我还尝试重新创建 Web 应用程序,以确保没有留下任何垃圾,并且我使用最新的所有内容。我该如何修复它?有什么想法吗?

Github issue

最佳答案

我认为这可能是由于缺少 UseIISIntegration 造成的调用您的启动代码。

Azure Web Apps 基于 IIS,因此在托管使用 Kestrel 运行的 ASP.Net Core 时,您需要此集成来允许 IIS 充当您的服务的反向代理。

希望对你有帮助!

关于c# - Azure Web 应用程序。指定的 CGI 应用程序遇到错误,服务器终止了该进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47621285/

相关文章:

postgresql - Azure Postgres 和查询性能洞察 : Query text not showing

c# - .NET 服务到 Linux 守护进程

C# 从 Entity Framework 将顺序插入列表

c# - 使用 RestSharp 反序列化 XML 文档时出错

asp.net - SignalR - 使用 (IUserIdProvider) *NEW 2.0.0* 向特定用户发送消息

asp.net - 将 ASP.NET vNext 应用程序部署到 Azure 云服务

具有 Azure SQL DB(托管标识)的 Azure 应用服务

c# - 为什么 azure 服务总线订阅会报告事件消息,但 onmessage 却没有检索到任何内容

c# - 是否有用于 Active Directory 查询的分析器?

c# - 在 asp.net c# 的 gridview 上更改行或记录的颜色?