Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net core 2.0 publish to azure get IIS 502.5 Error

I am starting with asp.net core 2.0 Created a new project with VS 2017. Published it to the windows azure. I got the error IIS 502.5 enter image description here

Check the log stream, I see this

Unhandled Exception: System.FormatException: The short switch '-argFile' is not defined in the switch mappings. at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load() at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at RecruitmentStore.Host.Program.BuildWebHost(String[] args) in D:\RecruitmentStore\RecruitmentStore.Host\Program.cs:line 20 at RecruitmentStore.Host.Program.Main(String[] args) in D:\RecruitmentStore\RecruitmentStore.Host\Program.cs:line 17

IIS Detailed Error - 502.5 - Bad Gateway

And here is my web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore requestTimeout="00:20:00" 
                processPath="bin\IISSupport\VSIISExeLauncher.exe" 
                arguments="-argFile IISExeLauncherArgs.txt" 
                forwardWindowsAuthToken="false" 
                stdoutLogEnabled="true" 
                stdoutLogFile="\\?\%home%\LogFiles\stdout"/>
    <directoryBrowse enabled="true" />
  </system.webServer>
</configuration>

I see the file IISExeLauncherArgs.txt generated inside the bin folder (in my local), but have no idea how it works in Azure.

enter image description here

Can you please tell me how to fix this? I did restarted the app service several times, that doesn't help

like image 777
khoailang Avatar asked Oct 04 '17 16:10

khoailang


People also ask

What is ANCM failed to start?

500.32 ANCM Failed to Load dll The app doesn't start. The most common cause for this error is that the app is published for an incompatible processor architecture. If the worker process is running as a 32-bit app and the app was published to target 64-bit, this error occurs.

How do I troubleshoot Azure app Service?

To access App Service diagnostics, navigate to your App Service web app or App Service Environment in the Azure portal. In the left navigation, click on Diagnose and solve problems.


1 Answers

As we found, the problem is that you have as part of your project a web.config that is only meant to be used when debugging locally in Visual Studio. If you exclude it form the project, msbuild will generate the correct one at deployment time, and it will run correctly on Azure.

like image 135
David Ebbo Avatar answered Sep 24 '22 14:09

David Ebbo