Freigeben über


How to perform a clean reinstallation of IIS

I've seen several scenarios where our customers need to reinstall IIS, a typical one is related to configuration file corruption. For example, you may see following event in System Event Log:

"The configuration section 'system.webServer' cannot be read because it is missing a section declaration."

The configuration file corruption can lead to a dysfunctionalities or outages of your website/application, and instead of checking the configuration files (such as ApplicationHost.config or web.config) one by one, line by line, it's usually more efficient to reinstall the web server then the application itself.

As we are all very familiar with how to install IIS, by simply checking the box "Web Server" in Server Manager (or you can check here : link), thus naturally we'll follow the same track to uncheck the box to uninstall IIS.

But after reinstallation, we'll find the same configuration on the server: same websites, same application, and probably the same problem.

That's because the configuration files for IIS (under C:\Windows\System32\inetsrv\config) are still in place, therefore when running IIS, it reads from the old files from same place – and if this folder contains the corrupted one, then the issue will still persist.

To completely uninstall IIS, you'll need to remove the following roles:

WARNING: this manipulation will erase all your configuration on IIS. It's highly recommended to make a full backup of your server before performing this action.

  • Web Server (IIS) under tab "Server Roles" in Server Manager :
    how-to-perform-a-clean-reinstallation-of-iis_1

  • And Windows Process Activation Service in "Features" tab in Server Manager :
    how-to-perform-a-clean-reinstallation-of-iis_2

    Attention: A server restart is necessary after the uninstallation.

  • Then delete the files or rename the folder (preferred) for C:\inetpub and C:\Windows\System32\inetsrv.

Here the key step is to uninstall Windows Process Activation Service (WAS). This is the service responsible for managing application pool configuration, creating and managing lifetime of worker process for HTTP and other protocols. Once WAS uninstalled, we can safely remove the configuration files located under C:\Windows\System32\inetsrv to finally make a clean uninstallation of IIS.

To reinstall IIS, just to follow the same steps: add Web Server (IIS) as well as WAS.

You may also be interested in:

IIS Windows Process Activation Service (WAS)
https://technet.microsoft.com/en-us/library/cc735229(v=ws.10).aspx

IIS Configuration Reference
https://www.iis.net/configreference

New features introduced in IIS 10.0
https://www.iis.net/learn/get-started/whats-new-in-iis-10/new-features-introduced-in-iis-100

Comments

  • Anonymous
    September 02, 2017
    I am running Windows Server 2016. I am unable to uninstall IIS and WAS (in any combination) as you describe. The uninstall works to the point of reboot and all messages state they are uninstalled. However, at the reboot start up, all goes well until the near the end of the reboot when it advises it is unable to remove and proceeds to reinstall all. THe machine returns to the same state with roles and features as they were.My problem began when I attempted to migrate my Windows Server 2008 R2 iis 7.0 to the Windows Server 2016 Standard (Desktop Experience) iis 10.0.
    • Anonymous
      October 03, 2017
      You may want to re-install the machine. Upgrade paths from Windows 2008 R2 to Windows Server 2016 are not supported. Otherwise, if you can, roll-back your upgrade, uninstall IIS when in Windows 2008 R2 and then try and perform the upgrade again.