Hi Albert,
Another way is queuing jobs. MSMQ or Service Broker (SQL Server 2005).
1. Create a job class instance in .NET and assign a unique id to it (GUID,
auto incr in some table).
public class Job
{
string ID;
}
1.1 This class is a great place to put in the criterias required to
perform the long-running task.
2. Track the job. For example: with the Ticket (Job.ID), INSERT TABLE
tblJobs SET Completed = FALSE WHERE ID = @ID
3. When the job is done make sure the job executor updates the completion
bucket to say the job is done.
UPDATE tblJobs SET Completed = TRUE WHERE ID = @ID
4. Until then, give your response page the Job ID. It will refresh (great
place to add an AJAX enabled progress bar) and use that ticket to check
whether the job is done or not in the completion bucket:
With the Ticket (Job.ID), Query for SELECT TOP 1 WHERE Completed = TRUE
AND ID = @ID
Others are welcomed to recommend a better way.
Best regards,
-- Li-fan
--
Li-fan Chen
Software analyst/developer, Entrepreneur
Markham, Ontario, Canada
Albert Pascual said:
What's the best system for a process that could take a long time,
minutes,
hours
a) Creating a webservice that calls a Thread?
b) Creatinga webservice with [SoapDocumentMethod(OneWay=true)]
c) Any better way? without using an external program?
Thanks
Al