0
  • I have an asmx web service that is part of my ASP.Net web application. I would like to use event-based approach of calling this web service in an async manner. Is this possible and if so how? If this is not possible, what are the alternatives?
  • Also, can I call in an async manner a static PageMethod in an aspx page that is decorated with '[WebMethod]' attribute? An example of page method I have is:

        [WebMethod]
    public static SupplierData GetAgeSummary(string supplierId)
    {
        return ABC.Data.SupplierData.GetAgeSummary(supplierId);
    }
    

By async I mean async in server-side and not on client-side.

1 Answer 1

1

The server side of a website can't be called asynchronously in a reliable fashion. Since all threads are only alive for the duration of the parent thread, if your asynchronous thread is still executing when the site finishes and moves on to the response, this will terminate the parent thread and all children will be forced to stop executing.

If the application you are using is a WinForms or WPF application using the web service as a reference then it can be called asynchronously because the application (which runs on the parent thread) can be relied upon to be alive for the duration of the service call. However, in a web application, it is too likely that the response will be constructed before the callback is delivered.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.