我不覺得這很容易設置;或者在安裝配置中缺少一個步驟,它不能正常工作,或者我實際上並不瞭解它的用途。這裏肯定有一些錯誤。問題顯然是我。我只是沒有得到這個工作。這是我所做的。Elmah基本設置問題
創建一個全新的mvc應用程序。 在About.aspx頁面放置以下內容。
<%throw new Exception(「blah」); %> 將內容放在此處。
點擊頁面會出現例外的黃色屏幕。
將elmah.dll添加到bin目錄。
添加到Web.config文件configurationSections:
<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>
添加到HttpHandlers的部分執行以下操作:
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
添加到模塊部分:
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
添加到處理器部分:
<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" preCondition="integratedMode" type="Elmah.ErrorLogPageFactory, Elmah"/>
添加ELMAH部分:
<elmah>
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
</elmah>
什麼奇怪的是這裏的是,該字符串的「.XmlFileErrorLog」部分顯示爲紅色,表明它「不能解析符號‘.ctor’一個錯誤的ReSharper 「當我查看Reflector中的elmah.dll時,顯示此對象在兩個公共構造函數中都需要」字符串「或」IDicationary「。
我使用VS 2008運行Windows Vista x64。將App_Data的權限設置爲Co_Owner。
http://localhost:xxxx/elmah.axd頁面確實顯示沒有錯誤。當我再次點擊我的「關於」頁面時,我仍然看到黃色屏幕,並且elmah.axd仍然顯示app_data文件夾沒有錯誤。
我取代的customErrors與創造相關的頁面:
<customErrors mode="On" defaultRedirect="GenericErrorPage.htm" />
自定義頁面顯示,但elmah.axd仍顯示「沒有錯誤」。 App_data仍然爲空!
由於源啓動這個設置我用: code.google.com/p/elmah/wiki/MVC
所以我在哪裏,在搞砸了?
〜 - = =邁克 - 〜
這做到了!謝謝!它在部分中缺失。 –
Mike
2009-06-08 23:38:47