1

I published a simple .NET 6.0 web app with user authentication on my IIS 10.0 web server hosted on Azure.
The application read and write data from a SQL Server 2017 database hosted on another machine on the same virtual network of the web server.

Everything works fine but after a while, even though nobody is using the app, it stop working and send Http Error 503 Service Unavailable and I have to restart it every time from the application pool.

I enabled tracing on the event log, but I don't receive any message explaining this.

These are the application settings: IIS application settings

I tried to follow these advices but none of them worked:

On the same web server I have other applications but this problem appears only on this one. None of the other apps is using .NET 6, most use .NET Framework 4.7/4.8 and another couple .NET Core 3.1.

I also tried to publish the application on Azure WebApp service and it has the same problem.

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
  • If your web app crashes quick enough to trigger application pool rapid fail protection, you should know that debugging is the only way out. – Lex Li Aug 12 '22 at 15:21

2 Answers2

0

1. If you're deploying on IIS, we can install DebugDiag Tools and then use the DebugDiag collection to crawl the dump logs.

2. If you are using the azure app service, it is recommended to get dump in the azure portal.


My Suggestion

  1. Enable Failed Request Tracing, and find which request will cause the Http 503.

    Maybe this 503 is not a problem with the code, and it is possible to find some useful information in the log.

  2. Check the EventViewer, try to find the useful info about the application.

  3. Download the DebugDiag Tools, use debugdiag collection to collect the dump file when the issue occured, and use the debugdiag analysis to analyze the dump file and check the stacktrace.

My suggestion can't tell you the root cause directly, but it will help you to find it. You are also welcome to update the useful stacktrace information in the future, and there will be more people to help you.

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
0

I'm currently having the issue but using MySQL on a remote server.

Azure WebApp, Azure VM (IIS 10) and AWS EC2.

Http Error 503 Service Unavailable when the database connection timesout or fails to connect and the AppPool failed to restart.

No crashes when debugging in VS via console app.

I changed the hosting model to out-of-process and this solved the issue.

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess">