What is the difference between Web Services Asynchronous Call and Asynchronous Task's.
Web服务异步调用和异步任务之间有什么区别。
We are working an a ASP.NET application that requires to make a call to a Web Service Method that will process thousand rows of data. This process usually takes between 2 to 3 minutes (maybe more maybe less it depends of the amount of Data). So we run all the time in Timeout's on that specific page.
我们正在开发一个ASP.NET应用程序,它需要调用一个Web服务方法来处理数千行数据。此过程通常需要2到3分钟(可能更多,可能更少,这取决于数据量)。所以我们一直在该特定页面上的Timeout中运行。
So we decided to go in rout of calling this Web Service Method Asynchronously, but we had a conflict caused by HTTP handler of one of the UI component's that we are using. Well lucky on that case we could remove the page from the httphandler directives.
所以我们决定以异步方式调用这个Web服务方法,但是我们遇到了一个由我们正在使用的UI组件的HTTP处理程序引起的冲突。幸运的是,我们可以从httphandler指令中删除该页面。
So far no issues, but here it comes the question, a coworker find out that we can use instead of Asynchronous Webs Services Call, wrap a Synchronous call in a Asynchronous Task in the ASP.NET page and be able to keep the directives to the component, and execute the Web Service Method with out getting a Timeout.
到目前为止没有任何问题,但问题来了,同事发现我们可以使用而不是异步Webs服务调用,在ASP.NET页面的异步任务中包装同步调用,并能够将指令保存到组件,并执行Web服务方法而不获取超时。
So now my concern is what kind of issues we can find using Asynchronous Task's instead of an Asynchronous Call.
所以现在我担心的是我们可以使用异步任务而不是异步调用找到什么样的问题。
Thank you in advance.
先感谢您。
2 个解决方案
#1
Web services should not be used in this manner by the way. There's a reason HTTP timeouts are so low. You should have the Web service trigger the task either by setting a flag in the DB that an actual service picks up on or the web service should spawn a process.
顺便说一下,不应该以这种方式使用Web服务。 HTTP超时非常低是有原因的。您应该让Web服务通过在数据库中设置实际服务选择的标志或Web服务应该生成进程来触发任务。
#2
If I understand your scenario, there should be no issues. In both cases, your page is asynchronous. In both cases, you don't wait for the service to complete - you give up the request thread while the service is running. In both cases, your page takes the same amount of time to execute as it would if you had called the service synchronously.
如果我了解您的情况,那么应该没有问题。在这两种情况下,您的页面都是异步的。在这两种情况下,您都不必等待服务完成 - 您在服务运行时放弃请求线程。在这两种情况下,您的页面执行的时间与您同步调用服务时所用的时间相同。
#1
Web services should not be used in this manner by the way. There's a reason HTTP timeouts are so low. You should have the Web service trigger the task either by setting a flag in the DB that an actual service picks up on or the web service should spawn a process.
顺便说一下,不应该以这种方式使用Web服务。 HTTP超时非常低是有原因的。您应该让Web服务通过在数据库中设置实际服务选择的标志或Web服务应该生成进程来触发任务。
#2
If I understand your scenario, there should be no issues. In both cases, your page is asynchronous. In both cases, you don't wait for the service to complete - you give up the request thread while the service is running. In both cases, your page takes the same amount of time to execute as it would if you had called the service synchronously.
如果我了解您的情况,那么应该没有问题。在这两种情况下,您的页面都是异步的。在这两种情况下,您都不必等待服务完成 - 您在服务运行时放弃请求线程。在这两种情况下,您的页面执行的时间与您同步调用服务时所用的时间相同。