ASP.NET Core Health monitoring on IIS (Log reason to restart)

4

I have an ASP.NET Core application running on .NET Framework. I host it on IIS and everything works fine except the fact that sometimes it's being restarted. I read that there are many reasons why IIS can restart the application. I found that for an ASP.NET app I could've put this in my web.config to log the reason into 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 doesn't seem to work with ASP.NET Core because the only log I get is: started process '4808' successfully and is listening on port '21455'. Any idea how to display the same thing?

Edit: From logs I can see that there are no unhandled exceptions. Event viewer doesn't log any reasons. I also disabled all recycling conditions under app pool "Recycling..." setup. It may be also quite important to note that I'm using SignalR behind the scenes.

Edit 2:

  1. I'm using 3rd party library which does something in the background task. 2. Application doesn't crash when self-hosted.
  2. When I Simulate heavy cpu usage and high memory usage, application is not restarted.
  3. Event log fail is created when I simulate deadlock.
  4. Application doesn't catch any unhandled exceptions, unobserved tasks.
  5. Event log works if I simulate app crash. It doesn't work only when I use this 3rd library (It looks like this lib is causing the problem).
  6. DiagDebug doesn't produce anything interesting:

In w3wp__DefaultAppPool__PID__4372__Date__03_06_2017__Time_03_44_34PM__887__Ntdll!ZwTerminateProcess.dmp the assembly instruction at ntdll!DbgBreakPoint in C:\Windows\System32\ntdll.dll from Microsoft Corporation has caused a breakpoint exception (0x80000003) on thread 9

TLDR 3rd library causes IIS to recycle the application without generating reason in event log. What could potentially happen in 3rd library?|

EDIT: I've figured out what the problem was. I had a following structure: -Site- ParentApp -ChildApp (nested in ParentApp)

My application was a ChildApp process and third party library was producing some data in ParentApp directory. Because they share the same app pool IIS was thinking that this is the change in configuration and restarting the process. Actually ParentApp should be just virtual directory but it was converted to application by accident. Still I have no idea how to log it in Event Viewer.

c#
asp.net
.net
iis
.net-core
asked on Stack Overflow Mar 2, 2017 by MistyK • edited Mar 9, 2017 by MistyK

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0