I have a WCF service that will host in IIS. Now I have some Connections that I create in the service constructor. I need to free these resources when the IIS hosting the service is disconnected or reset. These are not the resources that I will clean up every time the client disconnects, but they are wide application resources that will be released only when the service itself or IIS shuts down.
I saw another entry in which someone mentioned that he created a listener to capture ServiceHost events. Can someone help me figure out how to get the ServiceHost handle and capture the IIS reset or IIS shutdown event and free up my resources in the WCF service?
source share