Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Resource not found" error while accessing elmah.axd in ASP.NET MVC project

My ASP.NET MVC application is within a folder called Stuff within IIS 6.0 webroot folder. So I access my pages as http://localhost/Stuff/Posts. I had EMLAH working while I was using the in-built webserver of Visual Studio. Now when I access http://localhost/Stuff/elmah.axd, I get resource not found error. Can anyone point my mistake here! Here is config file entry,

<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/> //Handler
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/> //Module
like image 550
theraneman Avatar asked Jul 13 '09 16:07

theraneman


4 Answers

Working with IIS7 I found I needed both sections of the web.config populated (system.web AND system.webServer) - see Elmah not working with asp.net site.

Perhaps this is related.

like image 120
eyesnz Avatar answered Nov 02 '22 18:11

eyesnz


Have you added an ignore *.axd routes in global.asax?

like image 29
redsquare Avatar answered Nov 02 '22 19:11

redsquare


For Elmah, we need to differentiate between two things: First the http modules doing all the work of error logging, emailing...etc. Second, the http handlers, displaying the error log page and other pages (rss...etc.)

I was having the same problem of 404 resource not found because I have a weird setup! on my development machine, (windows 7, iis 7 ) elmah was working like a charm because the application pool was working in the integrated pipeline mode. In the production machine, however, the application was using the managed pipeline and I tried all my best to make elmah work but it was all useless...

I then got the idea of displaying the UI (error log page, rss, error detail,...) using regular aspx pages. I downloaded the source code, made some changes (sorry Atif, I was forced to do this because I needed the quickest solution) and then in my application , I created a folder under which I created regular aspx pages which inherits from Elmah defined pages. The page only contains one line (ex: for the detail page: <%@ Page Language="C#" Inherits ="Elmah.ErrorDetailPage"%>)

Now, I was able to run Elmah regardless of IIS 6/7 and it is working like a charm.. and It saved me from a big headache of correctly configuring http handlers and troubleshooting its work! additionally, configuring security is much simpler!

I don't know if the community is interested in this solution (If so, I am ready to post my full changes).

Hope that this gives you an idea on how to solve the problem in an alternative way (and if you need the modified dll with complete instructions on how to use it, just tell me!)

like image 2
Hassan Tabbal Avatar answered Nov 02 '22 18:11

Hassan Tabbal


In the application pool settings in IIS set Managed Pipelin Mode to Classic if you don't want to change code or the web.config file. Your axd.s will then work as before.

like image 1
Duane Urban Avatar answered Nov 02 '22 18:11

Duane Urban