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

痴心易碎 提交于 2019-11-27 22:13:17

问题


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

回答1:


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.




回答2:


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




回答3:


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!)




回答4:


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.




回答5:


Can you post the rest of your web.config?

Or, if you're comfortable enough, can you just ensure that the httpHandlers and httpModules (NOT handlers and modules) sections are filled in properly in the web.config?



来源:https://stackoverflow.com/questions/1120700/resource-not-found-error-while-accessing-elmah-axd-in-asp-net-mvc-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!