"Asynchronous operations are not allowed in this context"

14,859

Check out this answer. I won't copy/paste the answers from there but I'll extend the discussion some.

The accepted answer is NOT the correct one. Since there is no 'EndInvoke' there will be a resource leak every time this method is invoked. See this discussion on why that's not okay.

What is suggested instead is to launch either a daemon thread or create whole different processes that reads from MSMQ and processes the long-running tasks there.

Share:
14,859
Deeptechtons
Author by

Deeptechtons

SOreadytohelp Deeptechtons Programmer, Developer and Enthusiast always looking for chances to learn interesting technology. Meet awesome people and enhance life of people

Updated on June 05, 2022

Comments

  • Deeptechtons
    Deeptechtons almost 2 years

    I get the exception below when invoking he automagically generated async webmethods that i asked about in this post

    Asynchronous operations are not allowed in this context. Page starting an asynchronous operation has to have the Async attribute set to true and an asynchronous operation can only be started on a page prior to

    Google search results in add Async = True in the page directive but various people have noted that this makes the page 'Blocking' (which isn't true asynchronous operation). So how do i achieve asynchronous operation while calling webservice methods.