Deeptechtons
Deeptechtons

Reputation: 11125

"Asynchronous operations are not allowed in this context"

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.

Upvotes: 3

Views: 15988

Answers (1)

DanTheMan
DanTheMan

Reputation: 3277

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.

Upvotes: 2

Related Questions