Creation of the virtual directory failed with error: cannot write configuration file applicationhost.config

别等时光非礼了梦想. 提交于 2019-12-04 06:19:41

I too had this problem with my project files located on OneDrive. The way I resolved it was I renamed the applicationhost.config file located in the ".vs\config" directory of your root project directory then reloaded the web project. This will create a new applicationhost.config file.

I had the same error message sharing a project between 2 machines via OneDrive and fixed it as follows:

1 - Closed VS.Net

2 - Opened [myappnamefolder].vs\config\applicationhost.config in Notepad

3 - Searched the open file for the filename in my error message (In your case C:\Users\Visual Studio 2017\Projects\Testing\Version 2.0.vs\config\applicationhost.config ).

It was found under system.applicationHost, sites, site name, application path, virtualDirectory - physicalPath

4 - Amended the physicalPath value to point to the valid path of the project's config file as above.

5 - Saved the applicationhost.config file

My paths were different because I had different home user directories on each machine. (User A & User B)

I've had this problem several times using VS 2017 with Onedrive. Resolved it by renaming the application.config and having VS recreate it. Just as well could have edited line in the file. See the Diff below as an example.

The config file is located in something like C:\Code\MyProject\.vs\config\.

I just encountered this error. I followed the steps in this answer: https://stackoverflow.com/a/50508207/1166163

When I tried to save my changes I realised TFS had marked the file as read-only, preventing VS from updating the value. Removing the read-only attribute fixed the problem.

None of the above worked for me. I ended up deleting and recloning the repo that was giving me problems. It then opened up just fine.

Windows 10 Defender was causing this for me. When I disabled control folder access it worked again. Odd, because it had been working with that setting on for a while.

I have resolved this error with this way mention as below:

STEP 1: Go to on that path C:\Users\navz\OneDrive\Documents\IISExpress\config

STEP2: When you reach on this folder "config" in this folder we can see "applicationhost" file

STEP3: Close the Visual studio existing project and delete the applicationhost file(see on Step 2 path)

Then open again existing project it will reload automatically and work proper.

Had same problem then looked into vs\config\applicationhost.config and it was encrypted. I unencrypted file and solution loaded with no problems.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!