Sudhakar B.V.
Sudhakar B.V.

Reputation: 211

The IIS Express applicationHost.config file contains invalid entries and must be corrected before you can open project

I have installed Visual studio developer community version to practice coding. When I tried to create a new web project, I am facing issue like configuring IIS express failed, can not read the configuration file. I have tried all possible solutions like renaming the host file and closing and opening the visual studio. Nothing worked out. And I have tried to clone the project from git here also I am facing the same issue. Can someone please help me here.

Here is my error message.

enter image description here

Upvotes: 21

Views: 19192

Answers (6)

Kashif Atiq
Kashif Atiq

Reputation: 21

As suggested by @silas my issue was with OneDrive as well. after disabling OneDrive sync on "Documents Folder" problem gets resolved. To be precise system was trying to access "C:\Users[user name]\Documents\IISExpress\config"

Upvotes: 2

Elina Sitaylo
Elina Sitaylo

Reputation: 31

In my case with VS2019 works:

  1. close VS2019
  2. remove [my project].vs\config\
  3. rename c:\Users[username]\OneDrive\Documents\IISExpress\config to _config
  4. rename c:\Users[username]\Documents\IISExpress\config\ to _config
  5. load the solution to VS2019

Upvotes: 3

Tekonline
Tekonline

Reputation: 113

Here is another suggestion which seems a bit easier.

  1. Navigate to C:\Users\{{your user name}}\Documents\
  2. Rename the folder IISExpress to IISExpressold or something so that its archived
  3. Open your solution again.

It should open ok after these steps.

Upvotes: 7

Silas Humberto Souza
Silas Humberto Souza

Reputation: 176

In my case, the OneDrive application is removing by default the content of "C:\Users\username\Documents\IISExpress\config" folder, so Visual Studio cannot copy the .config files into .vs folder on the solution directory.

I resolved it by ensuring the files are on this path, and disabled the backup option on Documents directory in the OneDrive settings.

Upvotes: 1

Hamed Rezaei
Hamed Rezaei

Reputation: 388

I solved the problem with help of Drave answer. But I put that 3 files into below address:

[my project]\.vs\config\

when I put that files into confing folder and I reloaded the project, problem solved.

tnx again from Drave answer

Upvotes: 3

Drave
Drave

Reputation: 901

  1. Go: C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer
  2. Copy 3 files: applicationhost.config, aspnet.config và redirection.config
  3. Go to: Documents\IISExpress\config
  4. Paste and replace all 3 files
  5. Reload

Upvotes: 90

Related Questions