0
我有VS2015與MVC5和我安裝的Nuget包Elmah.MVC 但我無法得到它的工作。 當我提交URL地址Elmah不能在MVC5中工作
localhost:<port>/Elmah.axd
錯誤出現
HTTP Error 404.0 - Not Found
在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>
...
<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>
我錯過了什麼?
我通常從'/ elmah'而不是'/ elmah.axd'訪問我的。 – Luke
與/ elmah我有相同的錯誤 – Muflix
您的完整web.config是否包含有效的ELMAH配置? https://elmah.io/tools/configvalidator – ThomasArdal