ASP.NET射后不理(单程)Web服务 [英] ASP.NET Fire and Forget (One Way) Web Service

查看:373
本文介绍了ASP.NET射后不理(单程)Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在ASP.NET中创建一个普通的旧ASMX Web服务并添加SoapDocumentMethod(单向=真)]的函数调用,因为我读过这应该拨打电话异步。不过,我把这个在我的code和它绝对不会使异步调用,我的网页只是坐在那里等待完成工作的功能。是什么给了?

  [SoapDocumentMethod(单向=真)]
[的WebMethod(EnableSession =真)]
公共无效UpdateAccounts()
{
 //做工作
}//调用函数
GlobalServices服务=新GlobalServices();
服务.UpdateAccounts()


解决方案

您仍然必须使用异步方法调用。您应该调用 service.UpdateAccountsAsync()在这种情况下。

I've create a regular old ASMX web service in ASP.NET and added SoapDocumentMethod(OneWay = true)] to the function call as I've read this is supposed to make the call Asynchronous. However I call this in my code and it definitely does not make the call asynchronous, my page just sits there waiting for the function to finish working. What gives?

[SoapDocumentMethod(OneWay = true)]
[WebMethod(EnableSession = true)]
public void UpdateAccounts()
{
 //do work
}

//call the function
GlobalServices service = new GlobalServices();
service .UpdateAccounts()

解决方案

You still have to make the call using the Async method. You should make the call to service.UpdateAccountsAsync() in this case.

这篇关于ASP.NET射后不理(单程)Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆