I want to hook into the application start and stop events to track whether my IIS Hosted Workflow Services are running. Ideally, when I start my workflow service via starting the AppPool or the IIS Application (if multiple services share the same AppPool), I want to log an event into a database. And when I stop my workflow service via stopping the AppPool or the IIS Application, I want to log an event into the database.
Is there a way to do this?
You should check out this article on Windows Server AppFabric. Specifically, take a look at the section on "Tracked WF Events".
http://msdn.microsoft.com/en-us/library/ee677205(v=azure.10).aspx
AppFabric is a separate install (http://msdn.microsoft.com/en-us/library/ff637745(v=azure.10).aspx), but I think it will go a long way towards helping you accomplish your objectives regarding workflow and service monitoring.