13

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

2

6 Answers 6

70
  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
7
  • 2
    Don't know what's the cause of error, but it did solve it :D Jun 15, 2021 at 10:50
  • 6
    Onedrive had synced my Documents\IISExpress\config files from another computer which could have been the culprit.
    – h-rai
    Jul 22, 2021 at 23:48
  • 1
    Had same issue, but just because I have 2 versions of visual studio installed.
    – N.K
    Nov 15, 2021 at 7:22
  • On a 64-bit setup, you may need to get the files from C:\Program Files instead of C:\Program Files (x86). Dec 20, 2022 at 21:18
  • I found that the files are not there, just one drive equivalent of these files Feb 22 at 4:28
4

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.

2

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

1

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.

1

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
1

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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.