【问题标题】:Asp .NET Core on Azure got 502 Web server received an invalid response while acting as a gateway or proxy serverAzure 上的 Asp .NET Core 在充当网关或代理服务器时收到 502 Web 服务器收到无效响应
【发布时间】:2017-04-27 07:12:17
【问题描述】:

我在使用 azure 上部署的 asp .net 核心应用时遇到问题。

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>

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

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

host.Run();

谢谢:)

【问题讨论】:

  • 查看相关问题asp.net core app deployed on iis meets 500 internal server error。您可以从启用stdouLog
  • 你发现了吗?我也有同样的问题。
  • 首先,尝试输入 azure (kudu) 并删除 wwwroot 文件夹,或者确保在使用 VS Studio 部署时先清理文件夹(删除文件),我的问题是我改变了我的框架并且不清理旧的发布文件

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


【解决方案1】:

这里有一些你可以尝试的方法

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-17
    • 1970-01-01
    • 1970-01-01
    • 2019-05-31
    • 1970-01-01
    相关资源
    最近更新 更多