Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > asynchronous call from synchronous web service method

Reply
Thread Tools

asynchronous call from synchronous web service method

 
 
Secret Squirrel
Guest
Posts: n/a
 
      10-04-2005
Hi,

I have a web service in .net which does 2 things:

1) save some data that is sent as params to the web service
2) a second web service with the same params, get the results, and save
them to the database too.

now step 2) could take a while, so I want the WS to run step 2
asynchronously. I tried creating a method to run step 2, created a
MethodInvoker with it, and call it thru the MethodInvoker.BeginInvoke
to run it asynchronously, but I get an error in the bowls of the
asynchronously run method:

Error in async process Thread was being aborted

What is the solution? Can I not run an asynchronous process from a web
service? Is there some other way to run an asynch process from a WS
that would work? Any ideas?

I can see changing step 2 to a WS and having my first WS call the 2nd
asynchronously... But what I am already doing seems like it should
work?

Thanks,

Jon Paugh

 
Reply With Quote
 
 
 
 
CESAR DE LA TORRE [MVP]
Guest
Posts: n/a
 
      10-07-2005
I am afraid you cannot run a async web service from a synchronous web
service, neither from a ASP.NET normal .ASPX web page, because the
synchronous web service or ASP.NET normal .ASPX web page runs once and
finish, son when the end-event from the asynchronous web service tries to say
"hey, I've finished", by that time, the original synchronous web service
thread execution does not exists. (a synchronous WebMethod or a ASP.NET
normal .ASPX web page must run as fast as possible, and then it does not
exists any more within the server).

If you want to use asynchronous web services, you need a long-life app
thread, like a WinForms App, a Windows Service, etc. You need to have running
the original caller thread when the async web service ends and throws the
end-event.
Makes sense?
--
CESAR DE LA TORRE
Software Architect
[Microsoft MVP - XML Web Services]
[MCSE] [MCT]

Renacimiento
[Microsoft GOLD Certified Partner]


"Secret Squirrel" wrote:

> Hi,
>
> I have a web service in .net which does 2 things:
>
> 1) save some data that is sent as params to the web service
> 2) a second web service with the same params, get the results, and save
> them to the database too.
>
> now step 2) could take a while, so I want the WS to run step 2
> asynchronously. I tried creating a method to run step 2, created a
> MethodInvoker with it, and call it thru the MethodInvoker.BeginInvoke
> to run it asynchronously, but I get an error in the bowls of the
> asynchronously run method:
>
> Error in async process Thread was being aborted
>
> What is the solution? Can I not run an asynchronous process from a web
> service? Is there some other way to run an asynch process from a WS
> that would work? Any ideas?
>
> I can see changing step 2 to a WS and having my first WS call the 2nd
> asynchronously... But what I am already doing seems like it should
> work?
>
> Thanks,
>
> Jon Paugh
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between synchronous (proactor pattern) and synchronous model in web server Rickert C++ 0 10-06-2011 04:54 AM
asynchronous and synchronous call between apartments George2 C++ 0 04-05-2008 07:24 AM
HttpWebRequest: Processing synchronous or asynchronous Sojwal Chitnis ASP .Net 1 06-09-2005 06:15 PM
asynchronous call to web service from a web page mimi ASP .Net Web Services 5 07-25-2004 01:43 AM
VB Web Service Client that Makes an Asynchronous Method Call Vicky ASP .Net 0 02-16-2004 11:21 AM



Advertisments