Handler in Global web.config doesn't work

M

mcqwerty

Hello,
I'm trying to enable an error handling package at the root of my web server
by editing this file:

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config

In the httpHandlers section I've added:

<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory,
Elmah, Version=1.0.9414.0, Culture=neutral, PublicKeyToken=42734318a98ac1df"
validate="true" />

This handlder works fine when declared in the application's local
web.config. But when I move it to the global web.config calls to 'elmah.axd'
cause a 404 error. There are many other httphandlers in global web.config
that seem to work fine. I've tried path variations starting with a tilde(~)
and asterix at both ends; no luck.

Thanks for any advice.
 
J

Juan T. Llibre

Web.config files are only valid for an application or a subdirectory of an application.

Any changes you make to the global web.config will be reflected
in the web root's configuration, and not in individual applications.

Make the changes in your application's web.config.
 
M

mcqwerty

Thanks for your reply but you're mistaken. You can affect all your
applications by editing the global web.config file. IIS even offers a button
labeled "Edit Global Configuration..." on the "ASP.NET" tab of a website
properites dialog.

Many other changes I've made to the global web.config work fine. It's just
this httpHandler that's acting up.

Thanks again.
 
J

Juan T. Llibre

re:
!> Thanks for your reply but you're mistaken.

Do you think it possible that, perhaps, you don't grasp the subleties involved ?

You *cannot*, categorically, state that *any* changes made
to a global web.config are inheritable by all applications.

Some configuration parameters are reversible in a web.config. Others are not.
Some configuration parameters are exclusively for a single application. Others are global.

re:
!> Many other changes I've made to the global web.config work fine.
!> It's just this httpHandler that's acting up.

If you want to configure an httphandler so it works for all applications,
you should register it in the box's machine.config, not in the box's root web.config.

Registering an httphandler in the root web.config
will only allow the httphandler to work in the root web.

Here's an article which will make the concept(s) clearer to you:
http://www.15seconds.com/issue/020417.htm
 
M

mcqwerty

Juan T. Llibre said:
You *cannot*, categorically, state that *any* changes made
to a global web.config are inheritable by all applications.

True. That why I *never* stated any such thing.

many != any;

A little careful reading can prevent a lot of these pointless arguments.
Any changes you make to the global web.config will be reflected
in the web root's configuration, and not in individual applications.

This is wrong. Apparently hearing that you're dismissive, non-responsive
answer contains a mistake launches you into a sarcastic, patronizing snit.

Thanks for mentioning machine.config and the link. But they're hardly worth
the grief, are they?
 
M

mcqwerty

I finally found the answer here:

http://groups.google.com/group/elma...fd5?lnk=gst&q=machine.config#fe5ccc27275e0fd5

According to that thread httpHandlers in the various config files are merged
in reverse order than httpModules, etc.. So my handler with the path
elmah.axd needed to appear BEFORE the handler with the path *.axd, not after
as I was assuming.

So I moved it and everything works now. BTW I'm defining my handlers in the
root web.config not machine.config.
 
J

Juan T. Llibre

re:
!>> Any changes you make to the global web.config will be reflected
!>> in the web root's configuration, and not in individual applications.
!> This is wrong.

Test it...and let us know what you find out.

re:
!> Apparently hearing that you're dismissive, non-responsive answer
!> contains a mistake launches you into a sarcastic, patronizing snit.

Bite me if you're not willing to test what I assert from both experience and research.
 
M

mcqwerty

As I've previously noted in this thread, I got it working just as expected.
Everything is defined in global web.config and works for multiple
applications, httpHandlers and all.

So I consider your assertion to be tested and debunked.
 
J

Juan T. Llibre

<quote>
According to that thread httpHandlers in the various config files are merged
in reverse order than httpModules, etc.. So my handler with the path
elmah.axd needed to appear BEFORE the handler with the path *.axd,
not after as I was assuming.

So I moved it and everything works now.
</quote>


That's a new one for me. Thanks for the info.

The thread mentions that the ELMAH handler must go before the
..aspx handler, though, and not before the .axd handler. Is that correct ?

Which way did you change it ?
Before the .axd handler or before the .aspx handler, or before both ?
 
M

mcqwerty

That thread is somewhat out of date. Older version of ELMAH used a handler
with an aspx extension, but the latest uses axd.

I'm using axd so I moved it before the *.axd handler. It is also
incidentally above the *.aspx handler, but I don't think that is required.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top