WCF Exception Shielding

Topics: Exception Handling Application Block, Logging Application Block
Aug 17, 2010 at 4:50 PM

We have implemented WCF Exception Shileding. To shield the exception we are using Fault Contract Exception Handler where as to log the entry into windows event log for trouble shooting we are using Logging Exception Handler. It works in dev environment. However in test environment this is not working.

To troubleshoot this issue, I am curious to know what are the things should I be l looking for. I have checked the identity if the user the process runs under. It has same privileges as in dev.


Aug 18, 2010 at 1:05 AM

I suspect what are you missing here is that the event source that you're using are not yet registered in your test environment. Event sources must be registered with the operating system before you can successfully log using them. Normally the .NET framework will automatically create event sources the first time you use them, but creating event sources require administrator privileges. As such, any applications without admin rights (like almost all web applications) cannot create the event source and logging fails. (This is documented in FAQ item http://entlib.codeplex.com/wikipage?title=Why%20are%20messages%20not%20logged%3f&referringTitle=EntLib%20FAQ.)

When deploying your application, you should include an installer class to create your event sources. You can check using the EventLogInstaller Class on how to create your own installer.

If this is not the case on your problem please let us know.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.