473,883 Members | 1,786 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 4745
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
3001
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
2853
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
1674
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
1155
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
2014
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
8510
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
12415
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
1620
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
9792
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
11142
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
10847
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
10416
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
7129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5797
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4612
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
3
3233
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.