Reputation: 31
I am facing an issue, i need to recieve user request through an asmx webservice and for each request i need to:
1) Send back to the user an Id for his request. Something like: "Your request has been received with id ####". (The id is generated by the DB, an autoincrement column.)
2) Start a background process without blocking the user for response, i mean the webservice sends back the Id and starts the process in background.
I understand that maybe i should use WCF but i think the server cant run it, but if you could talk me about the answer of this in both of them kind of services, much better.
I have no idea about doing this task. I will appreciate your help.
Upvotes: 3
Views: 1542
Reputation: 4532
I would just run a background task (maybe in your global.asax) that works out of a queue of logged requests, picks them up and actually does them.
Your .asmx method would then just be adding to this queue (including the ID), thus can immediately return to the user while the task is being processed in the background...
Upvotes: 0
Reputation: 4156
You could use MSMQ. Create a queue to handle the incoming requests and a service to take tasks from the queue and process them. It'a hard to suggest the 'right' solution without knowing more about your specifics.
Upvotes: 0
Reputation: 40746
Usually I do this with the help of a scheduled task that starts a console application at regular intervals.
The communication between the ASMX web service and the scheduled console application is done through the database where I fill a work item queue table.
With this (maybe not that elegant aproach) I get the following benefits:
Depending on the requirements the scheduled task can run as often as needed, e.g. every 5 minutes or just once a day.
Upvotes: 1