The solution from my blog post (mentioned in the OP) was based on an existing solution that we used to change the HTTP response codes during the error state.
So, for us it was a one-line change to pass the exception to ELMAH. If there is a better solution, I would also like to know about it.
For Posterity / Reference and potential improvement - here is the code from the current solution.
classes HttpErrorHandler and ServiceErrorBehaviourAttribute
using System; using System.ServiceModel; using System.ServiceModel.Dispatcher; using System.ServiceModel.Channels; using System.ServiceModel.Description; using System.Collections.ObjectModel; using System.Net; using System.Web; using Elmah; namespace YourApplication {
Usage example
Decorate your WCF services with the ServiceErrorBehaviour attribute:
[ServiceContract(Namespace = "http://example.com/api/v1.0/")] [ServiceErrorBehaviour(typeof(HttpErrorHandler))] public class MyServiceService {
Will Hughes May 25 '09 at 12:11 2009-05-25 12:11
source share