473,382 Members | 1,362 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.

Thread on web method


Suppose I spawn a thread from a web method.

The thread runs a process that takes 10 minutes.

The main thread, running the web method, returns a value to the consumer
saying, "message rec'd".

Does the thread continue to process?

Is this any different from an "asynchronous" web service?

--
Texeme
http://texeme.com

Nov 23 '05 #1
4 2194
Elementary,

In dotNet it is forever
Ask get answer Ask get answer etc

So I see this as
Ask get answer "I am started wait for answer" that it is not is not
important for your client
Ask and start your process (you have tested if there is connection in your
previous question), and when it is ready give it back.

I don't see as often not any need for a thread in this because all that you
do in the main thread is the proces.

Just my thought,

Cor
Nov 23 '05 #2
Cor Ligthert wrote:

I don't see as often not any need for a thread in this because all that
you do in the main thread is the proces.


Sorry, Cor, actually this is for a completely different application...I
should have explained.

The situation is:

1) A web service that runs a Sql Server sproc and outputs a text file.
2) The sproc can take up to 10 minutes to run.
3) The consumer of the web service does not need to know if the file is
produced -- it just needs to kick off the process.

So, I thought the web service could:

1) Receive the request.
a. Spawn a thread to run the sproc and output the file

2) Immediately return a response to the consumer that says "message
received". And then the consumer would be released ( not subject to http
timeouts and so on. )
--
Texeme
http://texeme.com

Nov 23 '05 #3
The thread will continue to run but you need to be careful about a few
things. With IIS6 the worker process can be recycled at various times
causing all of the threads to be stopped.

If the IsBackground property of the thread is true then the thread will be
aborted if the worker process recycles. If IsBackground is false then the
thread will prevent IIS6 from restarting.

--
Ross Donald
..NET Code Generation - http://www.radsoftware.com.au/codegenerator/
"Elementary Penguin" <si*****@hare.krishna> wrote in message
news:d2*****************@newsread1.news.pas.earthl ink.net...
Cor Ligthert wrote:

I don't see as often not any need for a thread in this because all that
you do in the main thread is the proces.


Sorry, Cor, actually this is for a completely different application...I
should have explained.

The situation is:

1) A web service that runs a Sql Server sproc and outputs a text file.
2) The sproc can take up to 10 minutes to run.
3) The consumer of the web service does not need to know if the file is
produced -- it just needs to kick off the process.

So, I thought the web service could:

1) Receive the request.
a. Spawn a thread to run the sproc and output the file

2) Immediately return a response to the consumer that says "message
received". And then the consumer would be released ( not subject to http
timeouts and so on. )
--
Texeme
http://texeme.com


Nov 23 '05 #4
Elementary,

I think I see it now.
You want the thread in your "calling" program

However than I see no problems at all.

You call setup the webservice and shows in your calling program a message
as, "busy the file will be delivered in about 10 minutes keep the program
running".

Than you start (as you want that which for me depends if the program has
more purposes) an extra thread which starts the method of the webservice.
When the calling program gets the data, than when it is an extra thread, it
throws an event that can be catched by the main program and you go on.

I don't like extra threads which are not necessarry, therefore I like it
more just let the mainthread freeze with a waitcursor and by intance a
rolling gif on it, however about this are different opinions in these dotnet
newsgroups. (The last has nothing to do if it is difficult, because with an
extra thread this is also very simple, for me it is more the dependency
which has to be watched forever when using threads).

Is this what you mean?

Cor

Nov 23 '05 #5

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

Similar topics

16
by: Alvin Bruney | last post by:
I'm observing that a sleeping thread changes to stopped after a while. Is that accepted framework behavior for web applications? My thread basically does some work, and sleeps for 60 minutes...
5
by: Serge | last post by:
Hi, I am having a thread hang problem in my c# code. The example on the website: http://csharp.web1000.com/ is a simplified version of my problem. You will see in the form that a...
12
by: Ricardo Pereira | last post by:
Hello all, I have a C# class (in this example, called A) that, in its constructor, starts a thread with a method of its own. That thread will be used to continuously check for one of its...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
4
by: fred | last post by:
I use a Synclock in a secondary thread and also stop the thread using the abort method. If the abort occurs while the thread is in the Synclock will the SyncLock always be released before the...
3
by: JohnnyGr | last post by:
I have heard theres a new way to start threads with parameters in framework 2.0, does anyone know how to do that? this is what i need to do... Start a thread that executes some stuff, in this...
5
by: Alan T | last post by:
I will do several things in my thread: Copy a file to a location Update database record Read the file content Write the content to a log file If I call Thread.Abort(), it may be possible to...
2
by: Don | last post by:
How to stop a process which is running in a separate thread!!! I've got a class which performs some lengthy process in a background (separate) thread. And this lengthy process raises events...
7
by: Sin Jeong-hun | last post by:
I've using thread a lot in C#, but all of them were just single method with no return value or paramenters. It may sound bizarre but, can't it be a class? I'm writing an Windows application that...
6
by: mehdi | last post by:
Hi folks, You know, the Thread class has got a method named Abort which according to the msdn: "Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.