Ending all processes when application closes.

D

David Hirschfeld

I have built an asp.net application that runs in explorer
and does a bunch of screen scraping and posting to
various websites using httpWebRequest and
httpWebResponse. My application loops through various
URLs, performing various jobs on specified websites.
When I break the application in debug mode, all
associated processes stop accordingly. I have set the
Debugging Option to stop all process when a break is
hit. However, when I end the application in the midst of
debugging, some errant process continues to loop through
my URLS and continue to perform screen scraping
operations, even though the debugging session is no
longer running and explorer has closed. The only way to
stop the process is to kill aspnet_wp.exe, or to manually
restart IIS. Any ideas of what is going on?
 
M

MSFT

Hi David,

What did you mean "screen scraping " process, and how did you start the
httpWebRequest, with threads?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
N

Natty Gur

Hi,

if you are using threads ensure to set thier IsBackground property to
true. if you are using system.diagnostics.Process to start a process
Kill all the process before you exit your code.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
D

David Hirschfeld

I actually have two separate applications. In one application I spawn
thread to perform the WebRequests. That application exhibits the
behavior I mentioned previously. However in another application I
wrote, I make the WebRequest WITHOUT spawning threads. This application
also shows the same behavior.
 
D

David Hirschfeld

I'm not using either of the thread processing approaches mentioned in
the application that doesn't use any threading.
 
M

MSFT

Hi David,

As you mentioned, "some errant process continues to loop through my URLS
and continue to perform screen scraping" are these processes started by
system.diagnostics.Process, or threads, or objects created in your asp.net
application?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
D

David Hirschfeld

A button on my aspx page runs the following code:

Private Sub btnRespond_Click(...

Dim Response As String
Dim Brd As New clsPost(...
Response = Brd.AutoRespondToInvHits()
...
...
End Sub

clsPost is a class from a separate class library project.

The code running in the method:
Brd.AutoRespondToInvHits()
is the code that continues to run after a debugging session has ended.
There is NOT any 'process' or 'thread' or 'async' code in this method or
in any of the methods called by this method.
 
M

MSFT

From the code, the object "clsPost" wasn't released. It may be waiting for
response from the web site. You may manullay dispose these objects
somewhere, for exaplme, in session timeout.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
D

David Hirschfeld

How exactly do I trigger a dispose method when ending a debugging
session? And why do you think the session class doesn't get released
when I end debugging in the first place? It not only continues to run,
but it will loop through code continuing to make new requests to other
web pages even after I have ended debugging. It doesn't end until the
code has looped through all the web pages that it would have looped
through if I had never ended the debugging session. I'm running Windows
XP Prof and .NET 1.1 with VS 2003 if that helps you any.
 
M

MSFT

Hi David,

In you code:

Dim Brd As New clsPost(...
Response = Brd.AutoRespondToInvHits()

The new clsPost object was created and I haven't seen you released it. It
may continue to run if the program exist in abnormal way, for example,
terminate the debug session. You may refer to this article for more
information:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/
vaconFinalizeDestructors.asp

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
D

David Hirschfeld

I just tried the link you gave me and got the following message:
"Directory Listing Denied
This Virtual Directory does not allow contents to be listed."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top