vycma Posted February 10, 2010 Posted February 10, 2010 Hello, I'm hosting WCF services in Asp.net web page in (ASP.NET Compatibility Mode: AspNetCompatibilityRequirementsMode.Allowed). I've written simple HttpModule: public class ExceptionInterceptor : IHttpModule { public ExceptionInterceptor() { } public void Dispose() { } public void Init(HttpApplication context) { context.Error += new EventHandler(context_Error); } void context_Error(object sender, EventArgs e) { // do something } } web.config: <httpModules> <add name="ExceptionInterceptor" type="HttpModules.ExceptionInterceptor, HttpModules"/> </httpModules> My question is, why after occurence of unhandled exception in service, the code do not enter in context_Error(object sender, EventArgs e) function in my module. What's more, the code do not even enter the Application_Error(object sender, EventArgs e) in Globals.asax. Can someone explain that to me ? What is the best option for global exception handling in WCF services ? Regards Quote
Administrators PlausiblyDamp Posted February 11, 2010 Administrators Posted February 11, 2010 Not something I have done personally however I think you are best creating a class that implements the IErrorHandler interface, http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.ierrorhandler.aspx might be a good starting point. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
vycma Posted February 11, 2010 Author Posted February 11, 2010 Thanks Man, i've actually done exception handling exactly that way from msdn. But I still don't know why the asp httpModule don't work. Take care. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.