我有VS2015和MVC5,我安装了Nuget包Elmah.MVC 但我无法让它发挥作用。 当我提交URL地址
localhost:<port>/Elmah.axd
出现错误
HTTP Error 404.0 - Not Found
在web.config默认情况下nugget包添加了这个
<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>
...
<appSettings>
...
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
</appSettings>
<system.webServer>
...
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
我手动添加了这个,因为我试图修复错误并且还想在SQL数据库中存储应用程序错误
<system.web>
...
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
...
</system.web>
<configuration>
...
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah"
connectionStringName="database"
applicationName="MyAppName"/>
</elmah>
</configuration>
我错过了什么?
答案 0 :(得分:0)
我最近安装了,你的配置看起来很相似,除了我有这些:
<system.web> ..
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
。 。
<elmah>
<security allowRemoteAccess="yes" />
</elmah>
</configuration>
我没有您手动添加的条目。