开发者

ASP.NET Fire and Forget (One Way) Web Service

开发者 https://www.devze.com 2022-12-08 16:20 出处:网络
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 th

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开发者_StackOverflow 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.


Are you returning a value? The documentation for OneWay states that "fire and forget" web methods cannot return a value or have out parameters.

http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapdocumentmethodattribute.oneway(VS.80).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号