ASP.NET MVC+ELMAH - 发生异常时控制器方法需要很长时间才能响应
我正在使用在 ASP.NET MVC 中构建的 Web 应用程序。它部署到 IIS 7,并且我将其配置为使用 ELMAH 记录异常。
我面临的问题是,当控制器方法中发生异常时,即使我正在捕获/记录异常,也需要 15-20(或更多)秒来响应 HTTP 请求。因此,用户永远坐在那里想知道网站出了什么问题。这种情况发生在各种异常情况下;共同的线索似乎是,如果控制器方法中发生异常,就会出现问题。
有人见过这个问题吗?
注意:我运行的是 WinServer 2008 x64、ASP.NET MVC 2、.NET 4.0、IIS7、ELMAH 1.1,并且 Web.Config 中的 debug 设置为 False。不久前,这种情况还没有发生过。我不知道我可能做了什么改变才导致这种情况发生。
I'm working with a web application I built in ASP.NET MVC. It is deployed to IIS 7, and I have it configured to log exceptions with ELMAH.
The problem I'm facing is that when an exception occurs in a controller method, it takes 15-20 (or more) seconds to respond to the HTTP request, even if it's an exception that I'm catching/logging. So the user is left sitting there forever wondering what's wrong with the site. This occurs over all sorts of exceptions; the common thread seems to be that the problem appears if an exception occurs in a controller method.
Has anyone ever seen this problem?
Note: I am running WinServer 2008 x64, ASP.NET MVC 2, .NET 4.0, IIS7, ELMAH 1.1, and debug is set to False in Web.Config. This didn't used to happen a while ago; I don't know what I might have changed to cause this to start happening.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,那很快。我想通了。
ELMAH 用于存储错误的数据库已移至其他服务器,并且我忘记使用新的连接字符串更新 Web.Config。因此,它会等待错误日志记录数据库连接超时,然后再将 HTTP 响应返回给用户。
现在,有了正确的连接信息,异常就会像以前一样快速返回。
Ok, that was fast. I figured it out.
The database ELMAH was using to store errors was moved to a different server, and I forgot to update Web.Config with the new connection string. So it was waiting for the error logging database connection to time out before returning the HTTP response to the user.
Now, with the correct connection information, exceptions are returning quickly like they used to.
一些让您行动起来的想法:
这就是我会做的来追踪这个问题。他们的性能分析需要一些时间来适应,但它提供了出色的数据。
A couple of ideas to get you moving:
That's what I would do to track down the issue. Their performance profiling takes some getting used to but it provides excellent data.