c# - Azure 上的 Asp .NET Core 遇到 502 Web 服务器在充当网关或代理服务器时收到无效响应

标签 c# azure asp.net-core asp.net-core-mvc asp.net-core-1.1

我在使用 Azure 上部署的 ASP .NET Core 应用程序时遇到问题。

Azure 返回此结果:

Result from Azure

我的问题是:我该如何调试这个?这是为什么?/为什么会出现这种情况?这是一个 Asp .Net Core 问题吗?托管问题?

我正在使用 web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->

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

这是我使用 .UseIISIntegration().UseUrls("http://*:5000")

的 Program.cs
var host = new WebHostBuilder()
                .UseKestrel()
                .UseIISIntegration()
                .UseUrls("http://*:5000")
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseApplicationInsights()
                .UseStartup<Startup>()
                .Build();

host.Run();

谢谢:)

最佳答案

这里有一些你可以尝试的事情

  1. 检查 Azure 上的日志(如果启用了日志记录)

  2. 通过在启动类中使用 app.UseDeveloperExceptionPage();app.UseDatabaseErrorPage(); 方法启用开发人员异常页面。这将显示错误,然后您可以轻松查看错误来自何处

关于c# - Azure 上的 Asp .NET Core 遇到 502 Web 服务器在充当网关或代理服务器时收到无效响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43650954/

相关文章:

c# - 将同步方法变成异步方法

c# - 尝试使用 jQuery 和 Web API 通过自动完成将类的属性之一绑定(bind)到文本框

azure - 使用 cloud-Init 在 Azure 上安装 docker 和 docker-compose

c# - 我可以在 DbContext 的 ViewModel 中使用依赖注入(inject)吗?核心2.0

c# - WPF UserControl绑定(bind)问题

azure - 使用 Azure 表存储进行 ETL

c# - Autofac 与 azure 移动应用程序

unit-testing - Nunit 并行运行测试不起作用

c# - ASP.NET Core 3.0 身份不向我的浏览器添加任何身份验证数据

c# - 如何判断给定的类属于哪个命名空间?