Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2005

Tip: Looking for answers? Try searching our database.

asynchronous call from synchronous web service method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Secret Squirrel - 04 Oct 2005 20:03 GMT
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
CESAR DE LA TORRE [MVP] - 07 Oct 2005 11:36 GMT
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?
Signature

CESAR DE LA TORRE
Software Architect
[Microsoft MVP - XML Web Services]
[MCSE] [MCT]

Renacimiento
[Microsoft GOLD Certified Partner]  

> Hi,
>
[quoted text clipped - 23 lines]
>
> Jon Paugh

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.