I would post this in the issues of ASP.NET Core GitHub, but I wanted to post it here first to get some thoughts.
I'm running an ASP.NET Core 2 site on Windows Server 2012 R2 in IIS 8.5. The site can stay up for about a day or two, but at a seemingly random time, the site will restart. No exception is logged to the stdout log, but using DebugDiag to catch a crash dump, I can see that a "First Chance Access Violation" occurs. Here's a small portion of what DebugDiag's analysis tells me:
Exception #: 0XC0000005
Stack:
ntdll!RtlLockHeap+0x13e
ntdll!RtlEnterCriticalSection+0xe4
WINHTTP!WinHttpWebSocketCompleteUpgrade+0x104
WINHTTP!WinHttpWebSocketShutdown+0x86fa
WINHTTP!WinHttpWebSocketCompleteUpgrade+0x6c5
webio!Ordinal41+0x42f
webio!Ordinal18+0x688
webio!Ordinal24+0x142d
webio+0x246f
webio+0x23c7
KERNELBASE!FileTimeToLocalFileTime+0xe9
ntdll!RtlGetActiveActivationContext+0x252
ntdll!RtlFreeUnicodeString+0x1c24
KERNEL32!BaseThreadInitThunk+0x22
ntdll!RtlUserThreadStart+0x34
If I'm reading that stack trace correctly, WINHTTP!WinHttpWebSocketCompleteUpgrade+0x104 gets called, which eventually calls ntdll!RtlLockHeap+0x13e, which throws the exception. This would mean ASP.NET Core WebSocket code calls ntdll code, and then an exception occurs. It seems to me this could indicate a failure in ntdll (which I guess would be a failure of Windows Server 2012 R2) or could indicate a failure in the way the ASP.NET Core WebSocket code is calling ntdll. The fact that none of my code is included in the stack trace seems to indicate that my code is not at fault. The bottom of the stack trace is ntdll, the top is ntdll, and my code appears no where in between.
I'm curious what anyone else might think about the information I've presented. Is there a fault in my logic? Do you think this is a bug? If so, where should I file it? Thank you.