473,471 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can I restart IIS or server from ASPX page or web service?

Hi. I am wondering if its possible to restart IIS or my web server
simply from an IIS page? Not sure what code I would need and maybe
impersonation? Any thoughts or ideas anyone?

-Chad

Jun 19 '06 #1
1 1941
Doing IISRESET is a bit heavy-duty, I'd think. Why not start out by just
recycling the ASPNET Worker process:

private void KillAspNetProcess()
{
string processName = "aspnet_wp";
System.OperatingSystem os = System.Environment.OSVersion;

//Longhorn and Windows Server 2003 use w3wp.exe
if((os.Version.Major == 5 && os.Version.Minor > 1) || os.Version.Major ==6)
processName = "w3wp";

foreach(Process process in Process.GetProcessesByName(processName))
{
Response.Write("Killing ASP.NET worker process (Process ID:" +
process.Id + ")");
process.Kill();
}
}
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"DataSprings" wrote:
Hi. I am wondering if its possible to restart IIS or my web server
simply from an IIS page? Not sure what code I would need and maybe
impersonation? Any thoughts or ideas anyone?

-Chad

Jun 19 '06 #2

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

Similar topics

2
by: sean | last post by:
Hi there, I am trying to call a C# web service from an aspx page, I have the asmx file, a user control file ascx and the aspx file. I have verified that the web service is returning correct...
5
by: Rick Lemons | last post by:
While coding .aspx pages and testing them in IE, I sometimes get the error "Server Error in '/' Application". There is really no error. I have found that if I restart IIS and reload the same page...
3
by: John A Grandy | last post by:
In ASP.NET 1.1 and/or 2.0 ..... Is it possible to configure a web-app so that replacement of an .xml file ( physically located under the virtual dir root ) with a newer version of the file...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
0
by: Emanuele | last post by:
I have write a program using MS Visual studio C++ 7.0 (platform Windows XP professional). I'm not using .NET. This program save data in a SQL server 2000 database using ADO. Everything works...
0
by: MichiMichi | last post by:
My services shows once a while the infamous error "Service Unavailable" (http 503 error). This error happens only if my asp.net application encounters a problem with the SQL Server. In my case it...
2
by: moondaddy | last post by:
I had to repost this because I had to update and change my msdn alias. I will re-ask the question and clarify a few things that were not clear before. This code is all executed on my dev...
5
by: David Thielen | last post by:
Hi; We keep having to restart IIS after ASP.NET kills it. Below is what we have in the event log. Any idea what the problem is? thanks - dave Event code: 3003 Event message: A validation...
1
by: Sriram Srivatsan | last post by:
Hi We are trying to build an application where we render some of the .aspx pages from the database using a class derived from System.Web.Hosting.VirtualPathProvider. Users configure the...
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
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,...
1
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...
1
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
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...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.