473,397 Members | 1,960 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,397 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 2196
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.