We have a C# ASHX handler which calls into an unmanaged C library using [DllImport].
In some cases, the unmanaged C library got stuck in an infinite loop, however ASP.NET does not terminate it, causing the WorkerProcess w3wp.exe to consume 100% CPU core infinitely.
In another simple test case, where we add C# infinite loop (while(true){}) inside the C# ASHX handler, IIS terminates the execution as expected.
It looks like IIS does not take into account the execution of unmanaged code through [DllImport] into its executionTimeout logic.
Is this by design? How do we get around this, to get IIS to terminate the execution ?