IIS App Pool cannot recycle when there is an open ASP.NET 4.5 Websocket

前端 未结 3 2290
春和景丽
春和景丽 2021-02-15 15:18

I have run into an issue which can be replicated in the following way (you need IIS8 so must be on Windows 8+ or Windows Server 2012 R2+):

Create a new website in IIS Ma

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-15 16:01

    As far as I know, while a WebSocket is open, IIS won't tear down the app domain, so you see this behaviour exhibited.

    The best I can suggest is that you do some cross process signalling to force the old instance to shutdown. You could achieve this with an EventWaitHandle:

    1. Create a named EventWaitHandle in your web application, and signal it at startup.

    2. On a separate thread, wait on the wait handle

    3. When it is signalled, call HostingEnvironment.InitiateShutdown to force any running old instance to shutdown.

提交回复
热议问题