How do I redirect after a call to an online service?
Is there a way to get the web service (WCF / ASMX / etc) to invoke some processing after it returns the results? Note. I am not looking for asynchronous calls as the client has to return an ASAP result before any additional processing is done.
The primary limitation is that as far as I can tell, the only way to run the code on my server is through ASP pages or web services.
Can this be done by creating a background thread?
a source to share
Are you looking for a side effect that the client doesn't know or control for success? Astronomical processingeven if you return an immediate synchronous response. If the results are observable and of interest to the customer, you need to have a way for customers and operators to determine if they will succeed later.
It depends on how you host your web services (which are orthogonal from WCF providing communication and activation layer). Regular web service hosting will prevent you from handling things outside of WS calls, mainly so you don't shoot in the foot and eat up all the server resources.
- In the ASP.NET ASMX host, you can inject another task into the thread pool : however, this may be terminated without warning if the server load is excessive. Recently, we have had to resort to this in a production service: fortunately, the server server is not under heavy load. We are a little nervous about the reliability of this solution.
- I haven't worked with Windows Activation Services , but there should be a way to create additional work in a separate thread.
- You can always implement your own workflow for example. as a Windows service, and direct work to it as needed. It is not very difficult, but it takes a lot of work to work reliably and scalable. Not a favorite, but the type of WAS script is for a solution.
Bringing up another thread is easy, but not something that IIS should let you do freely, especially if it runs in any kind of web hotel with multiple applications.
a source to share
Okay, your web service will most likely be hosted on a Windows server, right? You can do any number of things:
- starting a windows workflow
- write a record to a database table, which is then scanned by another application / process, which then does something based on the record (e.g. send email, etc.).
- run console application
- calling another service on the same or different server
I think your options are really endless. However - they are not directly part of the web service as such - you would have to drop them before the web service call ends. Nothing happens in ASMX or WCF, which allows you to "send a request and continue execution" - your service method sends a response when it's done.
Mark
a source to share