How do I automatically restart iis?
Answer / Brashketu Dwivedi
To automatically restart IIS (Internet Information Services), you can add the following lines to your system's autostart folder. Go to 'C:Users<username>AppDataRoamingMicrosoftWindowsStart MenuProgramsStartup', create a new text file, name it 'iisrest.bat', and paste the following content:
```bash
@echo off
setlocal enabledelayedexpansion
cd /d %~dp0
set current=1
:loop
for /f "tokens=1,2 delims=:" %%a in ('wmic service where name="World Wide Web Publishing Service" get state /value') do if %%a == 4 set status=running
if not exist iisrest_%current%.txt (
echo Pausing IIS...
net pause iisadmin /app "Default Web Site"
echo Waiting for IIS to pause...
timeout /t 10 /nobreak > nul
if %status% == running goto loop
echo Creating iisrest_%current%.txt
powershell -command New-Item -Path .iisrest_%current%.txt
) else (
set /a current+=1
del iisrest_!current!-.txt 2>nul
)
echo Restarting IIS...
net start w3svc
timeout /t 60 /nobreak > nul
goto loop
```
Save and run the file as an administrator.
| Is This Answer Correct ? | 0 Yes | 0 No |
roles of information system in a business organization?
1 Answers Infeneon Technologies,
What is the iis service called?
How do I open applicationhost config?
What is the current version of iis?
What is meant by application domain?
How do I know if I have iis on windows server 2012?
What is App Pool and App Domain? What is the difference between the two.
Is iis more secure than apache?
IIS user accounts?
Explain how to create web garden?
What are virtual directories in iis?
Where are iis backups stored?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)