Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Handler in Global web.config doesn't work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mcqwerty - 11 Mar 2008 14:31 GMT
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.
Juan T. Llibre - 11 Mar 2008 14:50 GMT
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.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> Hello,
> I'm trying to enable an error handling package at the root of my web server
[quoted text clipped - 15 lines]
>
> Thanks for any advice.
mcqwerty - 11 Mar 2008 15:05 GMT
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.

> Web.config files are only valid for an application or a subdirectory of an application.
>
[quoted text clipped - 26 lines]
> >
> > Thanks for any advice.
Juan T. Llibre - 11 Mar 2008 16:24 GMT
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

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> 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
[quoted text clipped - 36 lines]
>> >
>> > Thanks for any advice.
mcqwerty - 11 Mar 2008 19:22 GMT
"Juan T. Llibre" wrote:
> 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.

Speaking of many vs. any. *You* are the one who wrote:

> 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?
Juan T. Llibre - 11 Mar 2008 21:59 GMT
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.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
>> You *cannot*, categorically, state that *any* changes made
>> to a global web.config are inheritable by all applications.
[quoted text clipped - 15 lines]
> Thanks for mentioning machine.config and the link. But they're hardly worth
> the grief, are they?
mcqwerty - 12 Mar 2008 17:22 GMT
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.

> re:
> !>> Any changes you make to the global web.config will be reflected
[quoted text clipped - 32 lines]
> > Thanks for mentioning machine.config and the link. But they're hardly worth
> > the grief, are they?
Juan T. Llibre - 12 Mar 2008 18:07 GMT
<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 ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> 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
[quoted text clipped - 38 lines]
>> > Thanks for mentioning machine.config and the link. But they're hardly worth
>> > the grief, are they?
mcqwerty - 12 Mar 2008 19:00 GMT
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.
mcqwerty - 11 Mar 2008 20:18 GMT
I finally found the answer here:

http://groups.google.com/group/elmah/browse_thread/thread/54c437e463c0326c/fe5cc
c27275e0fd5?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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.