一、 在NuGet下載Elmah.MVC dll文件!

或者點擊下載dll文件,並且引用客戶端。
二、配置WebConfig

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

<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
</httpModules>

<modules runAllManagedModulesForAllRequests="true">
<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>

<elmah>
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
<security allowRemoteAccess="true"/>
</elmah>
三、 見證奇跡的時刻



四、 總結Elamh這個組件使用還是比較簡單的並且可以在線查看錯誤日志,不需要寫任何C#代碼,簡單實用!
詳情:https://code.google.com/p/elmah/wiki/MVC
