You might need to restart Internet
Information Services (IIS) before certain configuration changes take effect or
when applications become unavailable. Restarting IIS is the same as first
stopping IIS, and then starting it again, except it is accomplished with a
single command. There are two ways to restart IIS:
- Using IIS Manager.
- Using the IISReset command-line utility.
Both methods allow you to stop, start,
and restart IIS Internet services. The Restart IIS command in IIS
Manager and the IISReset command-line utility do not restart the HTTP
protocol stack (HTTP.sys) or Internet services outside of IIS. In previous
versions of IIS, restarting IIS using the IISReset command-line utility
was a common practice for recovering from an unresponsive application.
Restarting or stopping IIS, or
rebooting your Web server, is a severe action. When you restart the Internet
service, all sessions connected to your Web server (including Internet, FTP,
SMTP, and NNTP) are dropped. Any data held in Web applications is lost. All
Internet sites are unavailable until Internet services are restarted. For this
reason, you should avoid restarting, stopping, or rebooting your server if at
all possible. IIS 6.0 includes application pool recycling and several other
features that provide alternatives to restarting IIS. For a list of features
designed to improve IIS reliability and remedy the need to restart IIS, see
"Alternatives to Restarting IIS" in this topic.
Note
|
Changes to the metabase can be lost
when restarting IIS. To avoid losing metabase changes and to trigger history
files that back up the metabase, use the SaveData method. For more
information about the SaveData method, see "SaveData" in the
Platform SDK on MSDN.
|
With IIS 6.0, the World Wide Web
Publishing Service (WWW service) lives in the service host, Svchost.exe. The
FTP, NNTP, and SMTP services and the IIS metabase, known as the IIS Admin
service, lives in Inetinfo.exe. If the IIS Admin service terminates abnormally,
IIS restarts automatically. This feature is known as Automatic Restart.
Previously, in IIS 5.0, if the IIS Admin service terminated abnormally, both
the WWW service and IIS Admin service had to be restarted because they shared
the same application space. In IIS 6.0, if the IIS Admin service terminates abnormally,
the WWW service does not go down because the IIS Admin service and the WWW
service run in separate process spaces. In this case, the WWW service
acknowledges that the metabase has terminated abnormally and checks to see if
the IISReset command-line utility is configured on the IIS Admin
service. If IISReset is configured on the IIS Admin service, IIS waits
for the IIS Admin service to start again and reconnects the WWW service.
All of the Internet services listed
below, if installed, are affected when you restart IIS. Not all of the services
listed below are installed by default.
Service
|
Description
|
IIS Admin service
|
This service
manages all the services of IIS other than the WWW service (FTP, NMTP, and
SMTP).
|
WWW service
|
This service
provides Web connectivity between clients and Web sites.
|
HTTP SSL service
|
This service
provides secure Web connectivity between clients and Web sites.
|
FTP service
|
This service
provides FTP connectivity and administration through IIS Manager.
|
SMTP service
|
This service
transports electronic mail across the network.
|
NNTP service
|
This service
transports network news across the network.
|
Important
|
You must be a member of the
Administrators group on the local computer to perform the following procedure
or procedures. As a security best practice, log on to your computer by using
an account that is not in the Administrators group, and then use the runas
command to run IIS Manager as an administrator. At a command prompt, type runas
/User:Administrative_AccountName "mmc
%systemroot%\system32\inetsrv\iis.msc".
|
Procedures
To restart IIS using IIS Manager
- In IIS Manager, right click the local computer, point to All Tasks, then click Restart IIS.
- In the What do you want IIS to do list, click Restart Internet Services on computername.
- IIS attempts to stop all services before restarting. IIS waits up to five minutes for all services to stop. If the services cannot be stopped within five minutes, all IIS services are terminated, and IIS restarts. In addition, clicking End now forces all IIS services to stop immediately, and IIS is restarted.
Caution
|
If IIS is terminated before its
services have stopped normally, data loss can result. If possible, back up
your IIS configuration before restarting IIS. See Backing Up and Restoring the Metabase for
information about backing up your IIS configuration.
|
Important
|
You must be a member of the
Administrators group on the local computer to run scripts and executables. As
a security best practice, log on to your computer by using an account that is
not in the Administrators group, and then use the runas command to run
your script or executable as an administrator. At a command prompt, type runas
/profile /User:MyComputer\Administrator cmd to open a
command window with administrator rights and then type cscript.exe ScriptName
(include the script's full path and any parameters).
|
To restart IIS using the IISReset
command-line utility
- From the Start menu, click Run.
- In the Open box, type cmd, and click OK.
- At the command prompt, type iisreset /noforce computername, and press ENTER.
Note
|
The /noforce parameter is
recommended as a safeguard against data loss in case the IIS services cannot
all be stopped within the one minute timeout period. If you are certain that
it is safe to force IIS to restart, you can omit the /noforce
parameter. In addition, if you are logged on locally, the computername
parameter is not required. If you are administering an IIS server remotely,
the computername parameter is the NetBIOS name of the computer on
which you wish to restart IIS.
|
- IIS attempts to stop all services before restarting. The IISReset command-line utility waits up to one minute for all services to stop. If the services cannot be stopped within one minute, all IIS services are terminated, and IIS restarts.
Note
|
You can adjust the timeout value
using the iisreset /timeout command.
|
The IISReset command-line utility has
several options available. For more information about the options available
with the IISReset command-line utility, open a command-prompt window,
and type iisreset /? You can also search for "iisreset" in
Windows Help.
Automatic
Restart
Automatic Restart is enabled by default
for the IIS Admin service and WWW service. If a process within either service
terminates abnormally, the service restarts automatically. The WWW service
restarts using the net start command. The IIS Admin service restarts
using the iisreset command. These commands are issued internally without
user intervention. You can disable Automatic Restart using the following
procedures.
To disable restart of IIS Admin service
- From the Start menu, right-click My Computer, and click Manage.
- In the console tree, expand the Services and Applications node, and click Services.
- Right-click IIS Admin Service, and click Properties.
- Click the Recovery tab, and in the First failure, Second failure, and Subsequent failures list boxes, click Take No Action.
- Click OK.
The following command can only be
issued on the local machine.
To disable restart of IIS Admin service
from the command line
- From the Start menu, click Run.
- In the Open box, type cmd, and click OK.
- At a command prompt, type iisreset /disable, and press ENTER. This command disables IIS and prevents all iisreset calls from executing.
Note
|
To re-enable the IIS Admin service,
at the command prompt, type iisreset /enable, and press ENTER.
|
To disable restart of the WWW service
- From the Start menu, right-click My Computer, and click Manage.
- In the console tree, expand the Services and Applications node, and click Services.
- Right-click World Wide Web Publishing Service, and click Properties.
- Click the Recovery tab, and in the First failure, Second failure, and Subsequent failures list boxes, click Take No Action.
- Click OK.
No comments:
Post a Comment