我已经在ASP.NET中创建了一个常规的旧ASMX web服务,并在函数调用中添加了SoapDocumentMethod(OneWay = true)],因为我读到这应该是为了使调用异步。然而,我在我的代码中调用了它,它绝对不会使调用异步,我的页面只是在那里等待函数完成工作。怎么回事?
[SoapDocumentMethod(OneWay = true)]
[WebMethod(EnableSession = true)]
public void UpdateAccounts()
{
//do work
}
//call the function
GlobalServices service = new GlobalServices();
service .UpdateAccounts()发布于 2009-10-09 02:49:18
您仍然需要使用Async方法进行调用。在这种情况下,您应该调用service.UpdateAccountsAsync()。
发布于 2009-10-09 02:53:05
你要返回值吗?OneWay的文档指出,“触发并忘记”web方法不能返回值或有输出参数。
http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapdocumentmethodattribute.oneway(VS.80).aspx
https://stackoverflow.com/questions/1541555
复制相似问题