Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2007, 10:43 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default Restarting IIS

Guys how can I restart the IIS from my code? can anyone help




Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
__________________
Nothing is impossible. The impossible only takes longer. \"Digital Fortress, Dan Brown\"
 
Old November 7th, 2007, 11:01 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This can be done but its more of a hack then anything else: first to even call IISRESET, for example, the user making the call must have Administrative rights which the ASP.NET account does not have by default. (And setting the ASP.NET account to run with administrative rights is a HUGE security issue)

Probably the best bet to do this is to create a .bat file and then create a process in code to start a command prompt with the aforementioned .bat file to restart IIS.

Here is an article on using .bat files to restart/kill iis
http://weblogs.asp.net/scottgu/archi...tilities-.aspx

Also, I would not suggest doing this. If you need to restart IIS do so at the server level because you will be up a creek if you create X code to restart IIS from a web application and then after you execute the code IIS never comes back up thus forcing you to log into the server anyway.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Restarting a context in Tomcat 5? probedb Apache Tomcat 0 October 10th, 2007 03:00 AM
iis.msc equivalent in IIS for Win XP Pro? RealDHelix Classic ASP Basics 14 March 18th, 2007 08:28 PM
restarting MySQL service resets all my privileges crmpicco MySQL 0 January 27th, 2006 11:33 AM
Restarting the current database GandolftheWhite Pro VB Databases 1 December 27th, 2004 07:55 PM
CreateObject error on IIS 4 but not IIS 5 timtom Classic ASP XML 1 December 5th, 2003 01:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.