如何以编程方式跟踪服务器超时?

发布于 2024-10-15 10:22:42 字数 193 浏览 5 评论 0 原文

我们有一个页面,使用普通的 接受视频文件上传。我们有用户(在本例中为学生)抱怨它不起作用,但没有提供任何类型的错误消息或任何内容。如果确实存在问题,我相信这将是由于尝试在连接不良时上传大文件而导致的超时错误。无论如何,是否有办法跟踪此事件以找出他们正在尝试做什么以及问题出在哪里?

We have a page that accepts video file uploads using a plain <input type="file" . We have had users (students in this case) complain that it's not working but not provide any type of error message or anything. If indeed there is a problem, I believe it would be a timeout error from trying to upload a large file on a bad connection. Is there anyway to track this to find out what they are trying to do and what the problem is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浸婚纱 2024-10-22 10:22:42

也许他们正在尝试上传大于允许的最大文件大小或请求超时的文件,这可以通过 web.config 中的以下部分进行控制:

<system.web>
    <httpRuntime executionTimeout="110" maxRequestLength="20000" />
</system.web>

此外,服务器的 EventLog 可能包含一些错误,这些错误可以为您提供更多线索。

另一个有用的事情是订阅 Global.asax 中的 Application_Error 事件,并尝试跟踪可能发生的所有未处理的异常:

protected void Application_Error(object sender, EventArgs e)
{
    HttpApplication app = (HttpApplication)sender;
    HttpContext context = app.Context;
    Exception ex = context.Server.GetLastError();
    // TODO : use your favourite logging framework to trace the exception
    // so that you can later see what went wrong. At least you should get
    // the exception stacktrace.
}

Maybe they are trying to upload files larger than the maximum allowed file size or the request timeouts which could be controlled by the following section in your web.config:

<system.web>
    <httpRuntime executionTimeout="110" maxRequestLength="20000" />
</system.web>

Also the server's EventLog probably contains some errors which could give you more clues.

Another useful thing is to subscribe for the Application_Error event in your Global.asax and try to trace all unhandled exceptions which might occur:

protected void Application_Error(object sender, EventArgs e)
{
    HttpApplication app = (HttpApplication)sender;
    HttpContext context = app.Context;
    Exception ex = context.Server.GetLastError();
    // TODO : use your favourite logging framework to trace the exception
    // so that you can later see what went wrong. At least you should get
    // the exception stacktrace.
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文