IIS is not working anymore after a system upgrade

Introduction

Suddenly this Monday, the PC hosting the bug tracker site jumped from Win10 1611 to 1709.

At the end of the upgrade process, the site was not available anymore.
IIS seemed up and running, but something occurred and put the site offline.

Looking at the event log, I saw swarms of the following errors:

Error 2307 – IIS-W3SVC-WP
The worker process for application pool ‘DefaultAppPool’ encountered an error ‘Cannot read configuration file’ trying to read configuration data from file ‘\\?\<EMPTY>’, line number ‘0’. The data field contains the error code.
Error 5002 – WAS
Application pool ‘DefaultAppPool’ is being automatically disabled due to a series of failures in the process(es) serving that application pool.
Error 5189 – WAS
The Windows Process Activation Service failed to generate an application pool config file for application pool ‘DefaultAppPool’. The error type is ‘5’. To resolve this issue, please ensure that the applicationhost.config file is correct and recommit the last configuration changes made. The data field contains the error number.
Error 5203 – WAS
A process serving application pool ‘DefaultAppPool’ reported a failure trying to read configuration during startup. The process id was ‘6240’. Please check the Application Event Log for further event messages logged by the worker process on the specific error. The data field contains the error number.
Warning 9009 – IIS-APPHOSTSVC
The Application Host Helper Service encountered an error trying to delete the history directory ‘C:\inetpub\history\CFGHISTORY_0000000012’. The directory will be skipped and ignored. Note that the directory may still get deleted in the future if the service restarts. The data field contains the error number.

‘DefaultAppPool’ is my IIS configuration, and it seemed to be correct.

The Resolution

After some investigation on the web, I found that it is a known problem and that it probably involves this folder:

C:\inetpub\temp\appPools\DefaultAppPool

I discovered that for unknown reasons, ‘DefaultAppPool’ was a corrupted shortcut into the ‘appPools’ folder.

To fix it, you need to:

  • open a Command Prompt with administrative access rights
  • stop IIS service
iisreset /stop
  • delete or rename ‘DefaultAppPool‘ shortcut.  If you tried to access to IIS site, this folder may be locked by some other system account.  To work around this, reboot and repeat the process without engaging IIS.
  • (optional) delete everything you can, from this folder:
C:\inetpub\history
  • reboot

In my case, IIS began working again.

Post Mortem Analysis

It seems that:

  • when the system starts, ‘C:\inetpub\temp\appPools\DefaultAppPool‘ isn’t present.
  • at the first site page request, ISS creates it
  • if an error occurs, it isn’t able to fix it by itself.