473,382 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Long process in ASP.NET


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

Feb 16 '06 #1
3 1122
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" <Al***********@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...

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

Feb 16 '06 #2
Hi,

Just an appendix: you can also peek into the queue to see if the job has
been dequeued. That tells you the job is done as well. Depending on the size
of the queue, it might be worth it to save the DB round-trip.

Best personal regards,
-- Li-fan

--
Li-fan Chen
Software analyst/developer, Entrepreneur
Markham, Ontario, Canada
"Li-fan Chen" <ob*******@hotmail.com> wrote in message
news:uE****************@TK2MSFTNGP15.phx.gbl...
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" <Al***********@discussions.microsoft.com> wrote in
message news:9E**********************************@microsof t.com...

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


Feb 16 '06 #3
Actually I was looking for something like somebody presses the button on the
webpage and the job starts!

"Li-fan Chen" wrote:
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" <Al***********@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...

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


Feb 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: PontiMax | last post by:
Hi, when I press the OK button of my dialog box a long-running task is initiated. Therefore I would like to make visible a div section right after clicking the button where a user-friendly...
18
by: Larry Herbinaux | last post by:
I'm having issues with garbage collection with my long-standing service process. If you could review and point me in the right direction it would be of great help. If there are any helpful...
4
by: ImSoLost | last post by:
I'm running a really long process from ASP.NET and need some help... I am making a method call when the user presses a button from my webpage, which goes into a database and parses a file. This...
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the...
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
1
by: walterbyrd | last post by:
I understand that Python has them, but PHP doesn't. I think that is because mod_php is built into apache, but mod_python is not usually in apache. If mod_python was built into apache, would...
4
by: commander_coder | last post by:
Hello, I write a lot of CGI scripts, in Python of course. Now I need to convert some to long-running processes. I'm having trouble finding resources about the best practices to do that. ...
2
by: =?Utf-8?B?QWxwaGFwYWdl?= | last post by:
Hello, I have a class MyWorker. Each time I create a new instance of MyWorker, I queue it to the ThreadPool. So, 1 MyWorker object is pooled and belongs to its thread (there can't have 2...
2
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a website using windows integrated security, with anonymous access turned off. The site is used to query orders from a database and when the search takes a long time, a windows login box...
32
by: John Wright | last post by:
I have a long process I run that needs to be complete before the user can continue. I can change the cursor to an hourglass, but I want to update the Status Strip on the bottom during the process. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.