我们正在对一些数据更新进行网络服务调用以同步另一个数据库。此 Web 服务调用会占用一些响应时间。将它添加到线程中会有帮助吗?这样做有什么缺点吗?如果 Web 服务调用失败,它就会失败,仅此而已。这就像一个火而忘记的电话。
最佳答案
您可以使用使用异步回调的异步 Web 服务调用来防止主线程阻塞。
By making an asynchronous call to a Web service, you can continue to use the calling thread while you wait for the Web service to respond. This means users can continue to interact with your application without it locking up while the Web service access proceeds.
关于另一个线程中的 ASP.NET Web 服务调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8749845/