In the event of an access violation, w3wp.exe will work and restart until the application pool is stopped

I have a WCF CLR 4 WCF service hosted in IIS 7.5 (Windows Server 2008 R2) using the WebHttp binding (with [WebGet] ). The service calls an unmanaged component implemented in C ++ (Visual Studio 2010).

I deliberately added an access violation to the unmanaged component (by repeatedly calling delete to the pointer, calling methods through the remote pointer, etc.) to check the dump generation settings. An access violation causes the w3wp.exe process to crash, which is not surprising given the β€œCorrected Status Errors” in the CLR 4 environment. However, when the process restarts (due to warm-up and permanent inclusion in IIS), the same request appears to be played to the service so that it ends the w3wp.exe process again. After a few times (determined by the Maximum Failures application pool parameter), the application pool is stopped.

I am using the browser as a test client, and while the restart sequence is running, the request is still in flight. When the application pool is stopped, the request is returned using 503 Service Unavailable .

I can work around the problem by placing a try...catch around the code and using the [HandleProcessCorruptedStateExceptions] attribute. When I do this, the w3wp.exe process does not crash. However, this is not the desired behavior β€” I want the process to fail (access violation or memory corruption is bad), but I want it to restart in a clean state and not repeat the request.

I could not reproduce the problem using the BasicHttp binding.

+4
source share
1 answer

This is how HTTP.sys works (a kernel driver that processes http requests at a lower level). It sends requests to the queue and sends them to IIS after pool / server recovery.

0
source

Source: https://habr.com/ru/post/1338865/


All Articles