This article is contributed. See the original author and article here.

If there is something wrong with the IIS config file (applicationHost.config), IIS Manager may crash with this error message:


 


There was an error while performing this operation. Unexpected end of file has occurred.


 


Nedim_0-1604091039824.jpeg


 


 


Solution


To find solution to this issue, pay close attention to the error message. It tells you which line number (Line 1026) in which file (applicationHost.config) has the issue. It also tells what the issue is (modules, system.webServer, location, configuration elements are not closed).


 


In my case, the file was actually cut off at the line 1026. Thinking about the issue history (It started occurring after building this server from a virtual machine disk copy), I guess that something went wrong during the disk copy.


 


Here are a few steps to try for solving this kind of an issue:



  • Manually edit the config file (For instance: If an element is missing a closing tag, you can add that tag manually)

  • Copy the config file from a backup

  • Restore the virtual machine

  • If there is another server with the same sites and configuration, compare the files and copy/paste the missing lines

  • Reinstall IIS and create sites from scratch

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.