HttpModule doesn't seem to work

I created a simple HttpModule for registering the use of an existing web service. There dll containing one class

public class TrackingModule : System.Web.IHttpModule
{
    public TrackingModule(){}

    public void Init(System.Web.HttpApplication context)
    {
        context.BeginRequest+=new EventHandler(context_BeginRequest);
    }

    public void Dispose()
    {

    }

    private void context_BeginRequest(object sender, EventArgs e)
    {
        try
        {
            Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish( new Exception("Log attept") );
            HttpApplication app = (HttpApplication)sender;
            string method = app.Request.RawUrl;
            SaveUseToDatabase( app.Request.UserHostAddress, method );
        }
        catch( Exception ex )
        {
            try
            {
                Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish( ex );
            }
            catch{}
        }
    }
}

After compiling the dll, I add it to the webservice bin folder and add it to the webservice web.config:

<system.web>
    <httpModules>
       <add name="TrackingModule" type="WebserviceTrackingModule.TrackingModule, WebserviceTrackingModule"/>

This works fine on my computer, but when I copy it to a production server, nothing happens. There are no new entries in the database, no entries are recorded by ExceptionManager. As if that is not the case.

What can I lose?

Edit: After running another test, I can add that it works when I add it for a web service that has its own top-level virtual directory. It does not work for web services that are in virtual directories, which are subfolders of another virtual directory.

, HttpModules , , .

+3
4

, . , -. Rick Strahl .

+3

, .

, <httpModules> web.config, . , , <location> web.config ( ).

: (

+1

http://forums.iis.net/t/1151924.aspx

, , .

3.5- web.config, , :

<system.webServer>

    <modules>

instead of system.web ... at least it works now.

So, to translate this:

If you have a problem with httphandlers

add a handler to the node modules in system.webserver and see if it works Copy the format used for the script module.

+1
source

It works?

<add name="TrackingModule" type="WebserviceTrackingModule.TrackingModule" />

And is the context_BeginRequest method specific to each request?

0
source

All Articles