asp.net-mvc – ASP.NET MVC – Elmah不工作,返回404页面为elmah.axd

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – ASP.NET MVC – Elmah不工作,返回404页面为elmah.axd前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_301_0@
我试图使用elmah为我的MVC应用程序,我已经遵循维基上的步骤: http://code.google.com/p/elmah/wiki/MVC,但即使如此,当尝试访问myapp / elmah.axd页面

404 – 找不到文件或目录.

有人可以帮我吗

OBS:我的IIS版本是7.5

如果有帮助我发布我的web.config的相关部分:

<sectionGroup name="elmah">
  <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler,Elmah" />
  <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler,Elmah" />
  <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler,Elmah" />
  <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler,Elmah" />
</sectionGroup>
...
</connectionStrings>
<elmah>
  <errorLog type="Elmah.XmlFileErrorLog,Elmah" logPath="~/App_Data" />
</elmah>
<system.web>
...
<httpHandlers>
  <remove verb="*" path="*.asmx" />
  <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
  <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,PublicKeyToken=31BF3856AD364E35" />
  <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,PublicKeyToken=31BF3856AD364E35" validate="false" />
  <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,Version=1.0.0.0,PublicKeyToken=31BF3856AD364E35" />
  <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory,Elmah" />
</httpHandlers>
<httpModules>
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,PublicKeyToken=31BF3856AD364E35" />
  <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,System.Web.Routing,PublicKeyToken=31BF3856AD364E35" />
  <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah" />            
  <add name="ErrorFilter" type="Elmah.ErrorFilterModule,Elmah" />
</httpModules>

并在我的Global.asax.cs

public static void RegisterRoutes(RouteCollection routes)
{   
  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
...

解决方法

您还需要填写system.webServer config部分,对于IIS 7. See this question.

猜你在找的asp.Net相关文章