在我的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