Asynchronous webservice call in vb.net

I am trying to call this web service asynchrounously in vb.net. So, on the aspx side, I added this async = "true" property. Now, on the vb.net code side, I have this function inside my web service that I call. So -

dim as as webservice.webstring
as.functionasync(param1, param2)

Now that I have launched the page, I see that it will not call the web service after a time interval. Should I add .thread.sleep ()? I need a beginAsyn function and an EndAsyn function. I am using asp.net 3.5 with IIS7

+3
source share
1 answer

First read this MSDN article on how asynchronous pages work in ASP.NET.

-, -. HOWTO , .

:

private _as as WebService.WebString = Nothing

Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    AddOnPreRenderCompleteAsync(New BeginEventHandler(BeginCallingWebService),
        New EndEventHandler(EndCallingWebService));
End Sub

Private Function BeginCallingWebService(Byval sender As Object, ByVal e As EventArgs, ByVal cb As AsyncCallback, ByVal state As Object)
    _as = New WebService.WebString()

    Return _as.BeginMyMethod(cb, state)
End Function

Private Sub EndCallingWebService(ByVal ar as IAsyncResult)
    Dim result As MyWebServiceResult = _as.EndMyMethod(ar)

    ' Process the result of the web-service method
End Sub

, .

+1

Source: https://habr.com/ru/post/1784185/


All Articles