Reputation: 78615
Is there a way to have a web service (WCF/ASMX/etc) call do some processing after it returns it's results? Note I'm not looking for a asynchronous calls as the client needs the result back ASAP, before the the extra processing is done.
The primary constraint is that as far as I can tell, the only way for me to run code on my server is via ASP pages or Web Services.
Can this be done by spawning a background thread?
Upvotes: 1
Views: 82
Reputation: 754778
Well, your web service will most likely be hosted on a Windows server, right? You could do any number of things:
I think your options are really quite endless. However - they're not directly part of the webservice per se - you'd have to kick them off before the web service call ends. There's really nothing in either ASMX or WCF which allows you to "send request and then continue executing" - your service method send the response when it is done.
Marc
Upvotes: 1
Reputation: 17258
You want a side effect which the client won't know about or control the success of? That is asynchronous processing, even if you return an immediate synchronous answer. If the results are observable and of interest to the client, you should have some way for clients and operators to determine whether it succeeded afterwards.
This hinges on how you host your web services (which is orthogonal from WCF providing a communications and activation layer). Normal web service hosting won't allow you process things outside the WS calls, mostly to prevent you from shooting yourself in the foot and eating all server resources.
Spawning another thread is easy, but isn't something IIS should permit you to do freely, especially if it's running in any sort of multi-application web hotel.
Upvotes: 1