上传后的ASP.Net超时处理文件

时间:2022-10-14 21:49:28

We have an ASP.Net web application on IIS7 that is used to upload Excel files and then load them into a SQL database by running jobs on the SQL server. The app will wait until the job completes then show the user a message. Due to some larger files being used the app is throwing the error below.

我们在IIS7上有一个ASP.Net Web应用程序,用于上载Excel文件,然后通过在SQL服务器上运行作业将它们加载到SQL数据库中。应用程序将等待作业完成,然后向用户显示消息。由于使用了一些较大的文件,该应用程序将抛出以下错误。

Network Error (tcp_error)

网络错误(tcp_error)

A communication error occurred: "" The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time. For assistance, contact your network support team.

发生通信错误:“”Web服务器可能已关闭,太忙或遇到阻止其响应请求的其他问题。您可能希望稍后再试一次。如需帮助,请联系您的网络支持团队。

The app uses an asp:View to progress from various steps. I have tried to bump the session timeout and httpRuntime executionTimeout values to account for how long the job takes to run but it does not appear to have any effect. I know the job completes but the app isn't showing that feedback to the user. I think the error is thrown as the app hits the logic to display the user the view showing all the final messages.

该应用程序使用asp:View从各个步骤进展。我试图碰到会话超时和httpRuntime executionTimeout值来说明作业运行多长时间但它似乎没有任何影响。我知道作业已完成,但应用程序未向用户显示反馈。我认为当应用程序按逻辑向用户显示显示所有最终消息的视图时,会抛出错误。

I can only guess that a) there is another setting I'm not aware of for timeout, b) another config file setting is overruling my web config setting for the app, or c) the asp:View is counting all the various steps as one long process and not reseting the "clock" as each step is completed.

我只能猜测a)还有另一个我不知道超时的设置,b)另一个配置文件设置是否覆盖我的应用程序的web配置设置,或者c)asp:View正在计算所有不同的步骤一个漫长的过程,并且在每个步骤完成时不重置“时钟”。

As I said, the file upload fine, and the job completes fine, the app just can't advance to that last step where it shows the user the view upon the end. Any ideas on what I can look for to fix this issue? My only other option would be to rewrite the app to not wait for the job to finish and handle notifying the user some other way.

正如我所说,文件上传很好,并且作业完成正常,应用程序无法前进到最后一步,它向用户显示结束时的视图。关于我可以寻找什么来解决这个问题的任何想法?我唯一的另一个选择是重写应用程序,不要等待作业完成并处理用户通知其他方式。

Update 1 After further testing it appears the error is from the ASP.Net custom code we created that does a SQL bulk copy and not the running of the SQL job. The current test runs around 220 seconds testing locally but causes a timeout on a test server.

更新1进一步测试后,似乎错误来自我们创建的ASP.Net自定义代码,它执行SQL批量复制而不是SQL作业的运行。当前测试在本地测试运行大约220秒,但会导致测试服务器超时。

Update 2 After more research I'm inclinded to think user pevgeniev is correct and this is just a limiting factor of the browser. The only thing that prevents me from marking this as answered is I don't know why file uploads don't appear to have the same issue.

更新2经过更多的研究,我倾向于认为用户pevgeniev是正确的,这只是浏览器的限制因素。唯一阻止我将其标记为已回答的是我不知道为什么文件上传似乎没有相同的问题。

1 个解决方案

#1


0  

If you're getting this error in the browser, than the timeout is on the client side, and there isn't much you could do server side. As you've suggested, you could rewrite the app, so that it polls for the result from the client, rather than expecting to finish the task in a single request.

如果您在浏览器中收到此错误,则超出客户端的超时,并且您可以在服务器端执行此操作。正如您所建议的那样,您可以重写应用程序,以便它从客户端轮询结果,而不是期望在单个请求中完成任务。

#1


0  

If you're getting this error in the browser, than the timeout is on the client side, and there isn't much you could do server side. As you've suggested, you could rewrite the app, so that it polls for the result from the client, rather than expecting to finish the task in a single request.

如果您在浏览器中收到此错误,则超出客户端的超时,并且您可以在服务器端执行此操作。正如您所建议的那样,您可以重写应用程序,以便它从客户端轮询结果,而不是期望在单个请求中完成任务。