1

I have a WCF service.

In some scenarios, the service fails, and requires manual intervention.

I want to be able to pass the exception to the service host and cause it to fail, instead of causing only the specific call to fail.

the service is an asynchronous MSMQ service and hosted in a custom application.

Ophir Yoktan
  • 8,149
  • 7
  • 58
  • 106

1 Answers1

2

This thread has a couple of ideas on how to communicate between the service and the host. Basically, you use a Singleton that both pieces can instantiate and share info on - beware of thread synchronization.

How to communicate between WCF service and host application?

Another option would be to set some flag using an IErroHandler whenever your service runs into problems then use an IDispatcherMessageInspector to check the flag before servicing any requests. It wouldn't stop the host, but it would prevent further service work until you restart.

Community
  • 1
  • 1
Mike Parkhill
  • 5,511
  • 1
  • 28
  • 38
  • 1
    The solution I used from the thread was to add an event to the WCF service, and have the main application listen to this event. – Ophir Yoktan Nov 11 '12 at 13:52