HttpModule and WCF (AspNetCompatibilityRequirementsMode.Allowed)

vycma

Newcomer
Joined
Feb 7, 2010
Hello,

I'm hosting WCF services in Asp.net web page in (ASP.NET Compatibility Mode: AspNetCompatibilityRequirementsMode.Allowed). I've written simple HttpModule:

Code:
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:

Code:
<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
 

vycma

Newcomer
Joined
Feb 7, 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.
 
Top Bottom