473,729 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

killing a process in C# web application

Does anyone know how i can kill a process using C#? im developing an asp.net
web application using C# and the asp.net process doesnt die even if the
application has already exited. So i need to kill the process someone.. does
anyone know the code for this? thank you so much in advance!!!!
Jun 14 '06 #1
8 4737
Hello RaiN,

Do you want kill w3w.exe forcely? How come?
What's the reason?

ASP.net app is hosted into IIS in separate domain and thus you can have several
iis hosted processes on your machine

R> Does anyone know how i can kill a process using C#? im developing an
R> asp.net web application using C# and the asp.net process doesnt die
R> even if the application has already exited. So i need to kill the
R> process someone.. does anyone know the code for this? thank you so
R> much in advance!!!!
R>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 14 '06 #2
Rain wrote:
Does anyone know how i can kill a process using C#? im developing an
asp.net web application using C# and the asp.net process doesnt die even
if the application has already exited. So i need to kill the process
someone.. does anyone know the code for this? thank you so much in
advance!!!!


It is normal for the asp worker process to continue running after the
application has exited, this is how it is designed to work. Why do you
think you need to kill the process?
--
Tom Porterfield

Jun 14 '06 #3
Bacuase i always get an error telling me that only one socket can be used or
something like that even if i already restarted the application. All my
sockets are killed b4 the application exits. The error message does not
appear when i manually kill the process.

I just need to kill the process b4 i exit so the next time i start my pp, i
wont be encountering the error. Does anyone know the C# CODE for it?

"Tom Porterfield" wrote:
Rain wrote:
Does anyone know how i can kill a process using C#? im developing an
asp.net web application using C# and the asp.net process doesnt die even
if the application has already exited. So i need to kill the process
someone.. does anyone know the code for this? thank you so much in
advance!!!!


It is normal for the asp worker process to continue running after the
application has exited, this is how it is designed to work. Why do you
think you need to kill the process?
--
Tom Porterfield

Jun 14 '06 #4
Rain wrote:
Bacuase i always get an error telling me that only one socket can be used
or something like that even if i already restarted the application. All my
sockets are killed b4 the application exits. The error message does not
appear when i manually kill the process.

I just need to kill the process b4 i exit so the next time i start my pp,
i wont be encountering the error. Does anyone know the C# CODE for it?


What is the exact name of the process you think you need to kill?
--
Tom Porterfield

Jun 14 '06 #5
Hello RaiN,

Killing the hosted process isn't normal situation, you need to treat with
you sockets neatly without brutal problem-solving

R> Bacuase i always get an error telling me that only one socket can be
R> used or something like that even if i already restarted the
R> application. All my sockets are killed b4 the application exits. The
R> error message does not appear when i manually kill the process.
R>
R> I just need to kill the process b4 i exit so the next time i start my
R> pp, i wont be encountering the error. Does anyone know the C# CODE
R> for it?
R>
R> "Tom Porterfield" wrote:
R>
Rain wrote:
Does anyone know how i can kill a process using C#? im developing an
asp.net web application using C# and the asp.net process doesnt die
even if the application has already exited. So i need to kill the
process someone.. does anyone know the code for this? thank you so
much in advance!!!!

It is normal for the asp worker process to continue running after the
application has exited, this is how it is designed to work. Why do
you
think you need to kill the process?
--
Tom Porterfield

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 14 '06 #6
Hi,

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:0B******** *************** ***********@mic rosoft.com...
Bacuase i always get an error telling me that only one socket can be used
or
something like that even if i already restarted the application. All my
sockets are killed b4 the application exits. The error message does not
appear when i manually kill the process.


Are you opening a listener ?

If you do not post a piece of code, or give more details of what the app
does we cannot help you much.
by the other hand the asp worker process most probably has nothing to do
with your error.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jun 14 '06 #7
"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:0B******** *************** ***********@mic rosoft.com...
Bacuase i always get an error telling me that only one socket can be used
or
something like that even if i already restarted the application. All my
sockets are killed b4 the application exits. The error message does not
appear when i manually kill the process.

I just need to kill the process b4 i exit so the next time i start my pp,
i
wont be encountering the error. Does anyone know the C# CODE for it?
I'm going to answer your question:
System.Diagnost ics.Process.Get ProcessById(... ).Kill

But, you should still consider what everyone else is saying. Normally,
there is no reason to kill the ASP.NET worker process. Perhaps you should
build an aspx page that calls AppDomain.Exit( AppDomain.Curre ntDomain), which
will kill your assemblies without affecting any other appdomains running in
the shared IIS ASP.NET process.

"Tom Porterfield" wrote:
Rain wrote:
> Does anyone know how i can kill a process using C#? im developing an
> asp.net web application using C# and the asp.net process doesnt die
> even
> if the application has already exited. So i need to kill the process
> someone.. does anyone know the code for this? thank you so much in
> advance!!!!


It is normal for the asp worker process to continue running after the
application has exited, this is how it is designed to work. Why do you
think you need to kill the process?
--
Tom Porterfield

Jun 14 '06 #8
Thanks Ben and everyone for your help and yes im aware of what you all are
saying. I just want to make sure that everythings clean after i exit the
application and before i start the application. Thanks everyone!

"Ben Voigt" wrote:
"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:0B******** *************** ***********@mic rosoft.com...
Bacuase i always get an error telling me that only one socket can be used
or
something like that even if i already restarted the application. All my
sockets are killed b4 the application exits. The error message does not
appear when i manually kill the process.

I just need to kill the process b4 i exit so the next time i start my pp,
i
wont be encountering the error. Does anyone know the C# CODE for it?


I'm going to answer your question:
System.Diagnost ics.Process.Get ProcessById(... ).Kill

But, you should still consider what everyone else is saying. Normally,
there is no reason to kill the ASP.NET worker process. Perhaps you should
build an aspx page that calls AppDomain.Exit( AppDomain.Curre ntDomain), which
will kill your assemblies without affecting any other appdomains running in
the shared IIS ASP.NET process.

"Tom Porterfield" wrote:
Rain wrote:
> Does anyone know how i can kill a process using C#? im developing an
> asp.net web application using C# and the asp.net process doesnt die
> even
> if the application has already exited. So i need to kill the process
> someone.. does anyone know the code for this? thank you so much in
> advance!!!!

It is normal for the asp worker process to continue running after the
application has exited, this is how it is designed to work. Why do you
think you need to kill the process?
--
Tom Porterfield


Jun 15 '06 #9

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

Similar topics

16
2983
by: Laura Conrad | last post by:
I'm writing an application that has to spawn some processes and then kill them later. It doesn't need to talk or listen to them while they're running, but there are stop and start buttons and the stop button should stop everything that gets started by the start button. There are lots of ways to do this on Linux, but this project has to run under cygwin. So far, the only thing I've gotten to work at all under cygwin is doing an...
3
2848
by: Andreas | last post by:
Hi, I just created my first vb.net pocket pc application - that consists of a main dialog and an additional dialog that is defined globally like this: Dim x as New MyTestDialog As the dialog's constructor takes a lot of time to do all that is necessary, it is called only one time when the process starts - and I just call ShowDialog any time I need to display it to the user.
7
717
by: Yosh | last post by:
I am developing an application that will stop and start a process on a remote machine. What security rights are needed for my application to be able to do this? Hope this makes sense. Yosh
6
1670
by: Dakkar | last post by:
How can i control my program when someone kill it's process from the taskmanager my dispose script is working well if i close the program manually but if i kill it from taskmanager its not working how can i fix it my dispose script is like this protected override void Dispose(bool Disposing) { if (Disposing)
0
1151
by: Shruti A via .NET 247 | last post by:
hello group I have recently started working on .Net platform. I am facing one problem in killing and starting process from my aspx page. I am able to kill and start the same process from vb.net but failed to do it from asp.net the exception that i am getting is :: "Couldn't get process information from remote machine." although i am doing it from the same machine from where i did it successfully using vb.net. don't know the route...
3
2006
by: kunal.kewalramani | last post by:
I'm opening an Excel file using ASP.NET, but Excel process remains it is not killed, I tried killing it by using Quit() that is also not working, if anybody have any solution for this please help me out. ********************************************************************** Sent via Fuzzy Software @ http://www.fuzzysoftware.com/ Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
10
8491
by: shiry | last post by:
Hi, I need to do some important cleanup before my console application exists. I used the console ctrl event. This is working well and it fires for all cases, including the CTRL_CLOSE_EVENT (if I close the application from the X botton). But on the contrary to what the MSDN indicates (ms-help://MS.VSCC.2003/MS.MSDNQTR.2003OCT.1033/dllproc/base/handlerroutine.htm), ending my process from the task manager did not fire the CTRL_CLOSE_EVENT....
8
12408
by: Rob | last post by:
Hello, I've got an issue where a process in a third party application has a dll which while exiting sort of freezes and runs away with processor cycles. i've written a block of code so that I can drill down into the process, and get the offending Thread's ID (since the only ones that will have the issue have higher User processor Time). But, I can't figure out how to have my .Net app 'kill' or 'suspend' a Thread
4
1617
by: Miro | last post by:
I'm using VB.Net 2003 I have code - it works great - to kill a process(s) if they are running. ---- Dim myProcesses() As Process 'Funny - withouth the () in the myProcesses it does not work Dim myProcess As Process myProcesses = Process.GetProcessesByName(Trim(TextBox1.Text)) For Each myProcess In myProcesses
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8144
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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 we have to send another system
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.