I have an ASP.NET Core application running on the .NET Framework. I host it on IIS and everything works fine, except sometimes it restarts. I read that there are many reasons why IIS can restart the application. I found that for an ASP.NET application, I could put this in my web.config to register the reason in the Event Viewer.
<healthMonitoring> <bufferModes> <add name="Critical Notification" maxBufferSize="100" maxFlushSize="20" urgentFlushThreshold="1" regularFlushInterval="Infinite" urgentFlushInterval="00:01:00" maxBufferThreads="1" /> <add name="Notification" maxBufferSize="300" maxFlushSize="20" urgentFlushThreshold="1" regularFlushInterval="Infinite" urgentFlushInterval="00:01:00" maxBufferThreads="1" /> <add name="Analysis" maxBufferSize="1000" maxFlushSize="100" urgentFlushThreshold="100" regularFlushInterval="00:05:00" urgentFlushInterval="00:01:00" maxBufferThreads="1" /> <add name="Logging" maxBufferSize="1000" maxFlushSize="200" urgentFlushThreshold="800" regularFlushInterval="00:30:00" urgentFlushInterval="00:05:00" maxBufferThreads="1" /> </bufferModes> <rules> <add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /> <add name="Failure Audits Default" eventName="Failure Audits" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /> <add name="Application Lifetime Events Default" eventName="Application Lifetime Events" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /> </rules> </healthMonitoring>
However, it does not work with ASP.NET Core, because it is the only log available to me: it successfully started the process "4808" and listens on port "21455". Any idea how to display the same thing?
Edit: from the logs, I see that there are no unhandled exceptions. Event Viewer does not log any reason. I also disabled all recycling conditions in the settings of the Utilization ... application pool. It's also very important to note that I'm using SignalR behind the scenes.
Edit 2:
- I use a third-party library that does something in the background job. 2. The application does not crash in self-service.
- When I simulate heavy CPU usage and high memory, the application does not restart.
- An event log crash is created when I simulate a deadlock.
- The application does not capture any unhandled exceptions, inconspicuous tasks.
- The event log works if I simulate an application crash. This does not work only when I use this 3rd library (this problem seems to be causing the problem).
- DiagDebug does not create anything interesting:
In w3wp__DefaultAppPool__PID__4372__Date__03_06_2017__Time_03_44_34PM__887__Ntdll! ZwTerminateProcess.dmp assembly instruction in ntdll! DbgBreakPoint in C: \ Windows \ System32 \ ntdll.dll from Microsoft Corporation caused a breakpoint exception (0x80000003) in thread 9
The third TL; DR library causes IIS to reprocess the application without generating a cause in the event log. What can happen in the 3rd library? |
EDIT: I found out what the problem is. I had the following structure: -Site-ParentApp -ChildApp (nested in ParentApp)
My application was a ChildApp process, and a third-party library created some data in the ParentApp directory. Since they use the same application pool, IIS thinks that this is a configuration change and a restart of the process. In fact, ParentApp should just be a virtual directory, but it was converted to an application by accident. However, I do not know how to register it in the Event Viewer.
source share