捕获请求超时数据
我在处理网络应用程序中的文件上传的 ashx 页面上遇到很多超时。有没有办法捕获超时并记录一些有关上传的数据,以帮助我更好地了解问题所在?
记录器看起来像这样,我只需要将它附加到超时异常!
Private Sub LogTimeoutException(context As HttpContext)
'Gather the data
Dim sb As New StringBuilder()
sb.AppendLine(String.Format("Toal files: {0}", context.Request.Files.Count))
For Each f As HttpPostedFile In context.Request.Files
sb.AppendLine(String.Format("{0} ({1}): {2}", f.FileName, f.ContentType, f.ContentLength))
Next
'Log it
Dim l As New BitFactory.Logging.FileLogger(context.Server.MapPath("~/timeoutlog.txt"))
l.LogInfo(sb.ToString())
End Sub
I'm getting a lot of timeouts on an ashx page which handles file uploads in my web app. Is there a way I could capture the timeout and log some data about the upload to help me better understand what the problem is?
The logger would look something like this, I just need to attach it to a timeout exception!
Private Sub LogTimeoutException(context As HttpContext)
'Gather the data
Dim sb As New StringBuilder()
sb.AppendLine(String.Format("Toal files: {0}", context.Request.Files.Count))
For Each f As HttpPostedFile In context.Request.Files
sb.AppendLine(String.Format("{0} ({1}): {2}", f.FileName, f.ContentType, f.ContentLength))
Next
'Log it
Dim l As New BitFactory.Logging.FileLogger(context.Server.MapPath("~/timeoutlog.txt"))
l.LogInfo(sb.ToString())
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么 try catch 不起作用?
Any reason why a try catch wouldn't work?