A WCF service is hosted in a Windows Service (WS).
When the database (SqlServer 2005) goes down a SqlException is thrown due to the actions performed on the database.
What I want to accomplish is that the WS – where the WCF service is hosted – should go down when the DB is also down.
The WS will be restarted manually by the way.
My idea is to do nothing about it. The unhandled exception will stop the WS.
Is this the correct way to do ?
If you want to explicitly stop your windows service, just call the .Stop() method on your service class.
Windows services can be configured to automatically restart on error – so just letting the SqlException flow to the top might not achieve what you want.
Marc