在我的ASP.NET MVC2應用ELMAH無法登錄任何HttpRequestValidationException
ELMAH沒有登錄HttpRequestValidationException
例如,如果我輸入'
(當您登錄到通過遠程桌面Web服務器和瀏覽該網站爲localhost除外)當我從我的電腦正常瀏覽使用域名我得到
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom
error settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could, however,
be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on
remote machines, please create a <customErrors> tag within a "web.config"
configuration file located in the root directory of the current web application.
This <customErrors> tag should then have its "mode" attribute set to "Off".
而沒有在Elmah日誌中顯示。
但是,如果我登錄到通過遠程桌面Web服務器和瀏覽網站爲localhost我可以看到完整的錯誤消息:
Server Error in '/' Application.
A potentially dangerous Request.Form value was detected from the client
我知道爲什麼顯示不同的錯誤信息,那是因爲我不t在我的web.config中有一個<customErrors mode="Off"/>
節點。但沒關係,我不希望向全世界顯示完整的錯誤消息。
但我確實希望是當它發生時爲ELMAH記錄這個錯誤。我需要做些什麼才能使其按預期工作?
僅供參考:在IIS7中,Application_Error似乎不能在集成管道模式下工作。 – 2013-06-20 14:07:26