473,495 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2199
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
2033
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
4006
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
2298
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
5050
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
2534
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
1867
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
2787
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
1946
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
1961
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
2924
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
6991
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
7160
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
7196
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
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.