I'm using an Angular 5 Application to send request to an ASP.NET web API server through an IIS server (version 7.5). I can include some base64 encoded image strings into my JSON file. Because of that, my sending request normally takes about 30s to complete. Everything is working fine. But then I noticed during the request time, if I shut down the browser ( Safari ), CPU usage of w3wp.exe process on server suddenly raise up from 5% to about 50-60% and will keep raising up forever until I kill it.
=============================
Here is a dump log I found by using Debug Diagnostic Tools:
Thread 33 - System ID 9708
Entry point ntdll!RtlUserThreadStart+1d
Create time 2018/11/27 11:22:22
Time spent in user mode 0 Days 04:39:44.303
Time spent in kernel mode 0 Days 00:00:23.992
This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.
.NET Call Stack
Function
System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef) System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)
Full Call Stack
Function
Source
clr!ExceptionTracker::CallHandler+fd
clr!ExceptionTracker::CallCatchHandler+90
clr!ProcessCLRException+31c
ntdll!RtlpExecuteHandlerForUnwind+d
ntdll!RtlUnwindEx+539
clr!ClrUnwindEx+40
clr!ProcessCLRException+2e9
ntdll!RtlpExecuteHandlerForException+d
ntdll!RtlDispatchException+45a
ntdll!RtlRaiseException+22f
KERNELBASE!RaiseException+39
clr!RaiseTheExceptionInternalOnly+2aa
clr!IL_Throw+10b
0x000007fe`9996bcb7
0x000007fe`99969002
0x000007fe`9996ea9f
0x000007fe`9996dd5d
0x000007fe`9996ca63
0x000007fe`9996b977
0x000007fe`99969002
0x000007fe`999677fa
0x000007fe`999674f5
0x000007fe`99966f36
0x000007fe`999664e0
0x000007fe`999661f1
0x000007fe`999660d0
0x000007fe`99965bb0
0x000007fe`999652be
0x000007fe`99964cc7
0x000007fe`99963ef3
0x000007fe`99963d95
System_Core_ni+3004fe
0x000007fe`9930df4a
0x000007fe`9930d8d6
0x000007fe`9930a8db
0x000007fe`99309a9d
0x000007fe`993018c7
0x000007fe`990b2b7b
0x000007fe`990b280e
System_Net_Http_ni+2cb85
0x000007fe`990b2053
System_Net_Http_ni+2ce35
0x000007fe`990b0c53
System_Net_Http_ni+2cb85
0x000007fe`990aeea7
System_Web_ni+2f5419
System_Web_ni+9c44e3
System_Web_ni+2b64f0
System_Web_ni+2cab1c
System_Web_ni+2b6fe9
System_Web_ni+2c8ffb
System_Web_ni+2b812d
System_Web_ni+2b7d33
System_Web_ni+9b2ec2
clr!UMThunkStub+6e
webengine4!W3_MGD_HANDLER::ProcessNotification+8e
webengine4!W3_MGD_HANDLER::DoWork+3a5
webengine4!RequestDoWork+3fc
webengine4!CMgdEngHttpModule::OnExecuteRequestHandler+21
iiscore!NOTIFICATION_CONTEXT::RequestDoWork+233
iiscore!NOTIFICATION_CONTEXT::CallModulesInternal+174
iiscore!NOTIFICATION_CONTEXT::CallModules+25
iiscore!W3_CONTEXT::DoWork+34d
iiscore!W3_CONTEXT::IndicateCompletion+8c
webengine4!W3_MGD_HANDLER::IndicateCompletion+5d
webengine4!MgdIndicateCompletion+22
System_Web_ni+324c6e
System_Web_ni+2b82f5
System_Web_ni+2b7d33
System_Web_ni+9b2ec2
clr!UM2MThunk_WrapperHelper+43
clr!UM2MThunk_Wrapper+60
clr!Thread::DoADCallBack+13d
clr!UM2MDoADCallBack+b3
clr!UMThunkStub+26d
webengine4!W3_MGD_HANDLER::ProcessNotification+8e
webengine4!ProcessNotificationCallback+42
clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+1bc
clr!ThreadpoolMgr::ExecuteWorkRequest+64
clr!ThreadpoolMgr::WorkerThreadStart+f5
clr!Thread::intermediateThreadProc+86
kernel32!BaseThreadInitThunk+d
ntdll!RtlUserThreadStart+1d
What can I do to prevent this from happening? If my user close browser during request time, I want my IIS server automatically stop this w3wp.exe process.