locked
In wich condition IIS want to unload the ISAPI extension DLL? RRS feed

  • Question

  • User207418774 posted

    And can i prevent IIS to unload, because i use thread pool in the DLL, if IIS want to unload, i need clean those threads.

    And if next time a request come, i need initialize the pools again, that maybe a waste to sys resource, and maybe low performance.

    Thanks first.

    Wednesday, January 9, 2008 10:55 PM

All replies

  • User209782248 posted

    Hi haigui_chen,

    IIS will typically load your ISAPI extension once per W3WP lifetime, and unload it when the process is shutting down. If you clear the "Cache ISAPI Application" option for your scriptmap, IIS will load and unload your ISAPI extension DLL per request (which you definitely dont want to do).

    IIS will call the TerminateExtension() entrypoint before unloading your DLL, where you should stop your threadpool.

    IIS will attempt to drain all existing requests before calling TerminateExtension, so theoretically there shouldnt be any requests. I am fairly sure that this is guaranteed, and if some requests are hung, you will never receive TerminateExtension() and instead WAS will kill the worker process after it exceeds the shutdown time limit.

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more IIS 7.0 posts, tools, and info

    Thursday, January 24, 2008 11:00 AM