ASP.NET MVC 3 404 错误和异常处理
记录异常并向用户提供记录的错误代码的最佳方法是什么。除此之外,404 错误是如何处理的。我见过很多针对这两种情况的解决方案,但没有以一种非常适合 mvc 模型的方式组合在一起。你也有例子吗?另外,对于 404,即使用户尚未登录应用程序,是否有办法获取 404?
elmah 应该在生产中使用吗? 人们是否建议使用 nuget 包?
What is the best way to log an exception and give the user the error code that was logged. Along with this how are 404 errors handled. I have seen many solutions for both but not together in a way that fits nicely with the mvc model. Do you have an example too? Also for 404's is there a way to get the 404 even if the user hasn't logged in to the app?
Is elmah something that should be used in production?
Is there a nuget package that people suggest using?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,使用 elmah,但请确保对日志查看器的访问受到控制。
该包是 Elmah.MVC,并确保您阅读了以下内容:
http://www.hanselman.com /blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx
http://dotnetdarren.wordpress.com/2010/07/27/logging-on-mvc-part-1/
Yes, use elmah, but make sure that access to the log viewer is controlled.
The package is Elmah.MVC, and make sure you read these:
http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx
http://dotnetdarren.wordpress.com/2010/07/27/logging-on-mvc-part-1/