在我的ASP.NET MVC2应用程序中,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
我知道为什么会显示不同的错误消息,这是因为我没有 <customErrors mode="Off"/>
我的web.config中的节点。但是没关系,我不希望向全世界显示完整的错误消息。
但我想要的是让Elmah在发生错误时记录此错误。我需要做些什么才能使其按预期工作?