Jump to content
Xtreme .Net Talk

HttpModule and WCF (AspNetCompatibilityRequirementsMode.Allowed)


Recommended Posts

Posted

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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...