Jose Barbosa
Jose Barbosa

Reputation: 222

Asp .NET Core on Azure got 502 Web server received an invalid response while acting as a gateway or proxy server

I am having troubles with an asp .net core app deployed on azure.

Azure returns this result:

Result from Azure

My question is: How can I debug this? Why is this?/Why this occur? It is a Asp .Net Core problem? A hosting problem?

I am using 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>

and this is my Program.cs using .UseIISIntegration() and .UseUrls("http://*:5000")

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

host.Run();

Thanks :)

Upvotes: 1

Views: 2900

Answers (1)

Temi Lajumoke
Temi Lajumoke

Reputation: 2400

Here are a few things you can try

  1. Check your Logs on Azure (if you enabled logging)

  2. Enable Developer exception page by using the app.UseDeveloperExceptionPage(); & the app.UseDatabaseErrorPage(); methods in your startup class. This would display the errors, and then you can easily see where the errors are coming from

Upvotes: 1

Related Questions