Newbie
Newbie

Reputation: 7249

How to allow IErrorHandlers to handle AccessViolationExceptions in WCF?

Sure, we must avoid catching and attempting to handle AccessViolationExceptions(AVEs). However, in my current case, the exception is thrown from a COM+ managed component which terminates the process that threw the exception, therefore, cleaning up correctly. However, a windows service, hosting WCF, that consumes said COM+ component receives the bubbled up AVE causing the service crash.

The IErrorHandlers in place don't seem to fire/detect AVEs.

Is there any way to enable WCF IErrorHandlers to catch AVEs?

Upvotes: 2

Views: 234

Answers (2)

Newbie
Newbie

Reputation: 7249

It is not possible for IErrorHandlers to catch exceptions similar to AccessViolationExceptions (SEHExceptions).

Upvotes: 0

Slava Kovalchuk
Slava Kovalchuk

Reputation: 523

As a variant you can try to add a handler on AppDomain.CurrentDomain.UnhandledException where you can restart a service again.

Or, you can run your main win_service in one ('Main')AppDomain and host the WCF service in another ('Sub')AppDomain. In such way you can unloaded(reload) the sub-proccess without affecting the main process.

Upvotes: 1

Related Questions