Is there an event that fires when a WCF service gets started or shut down? Hopefully, independent of whether it is self hosted or hosted in IIS?
+3
A:
Sure, the constructor of your object (especially if you are using a Singleton style). Please pardon the shameless self promotion, but I've written two articles on how to get started with a WCF (Net.Tcp) client/server system... The first is non-IIS (to which the service starts on your own terms), the latter is how to modify the first to be hosted in IIS to which my first sentense would apply:
Timothy Khouri
2008-11-03 20:00:07
Singleton did the trick, thanks.
Jake Pearson
2008-11-04 21:04:21
+2
A:
ServiceHost exposes quite a few events:
http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehost_events.aspx
You could hook into these events by using a custom service behavior:
http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iservicebehavior.aspx
jezell
2008-11-03 20:50:57