Unexpected end of file has occurred

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

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

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.