Creating a virtual directory failed with the error

2019-02-01 15:18发布

I can't solve this problem

enter image description here

I suggest I have to change c:\Windows\System32\drivers\etc\hosts file and add after

# localhost name resolution is handled within DNS itself.

the next line:

127.0.0.1       mysite.dev

but it doesn't help. Any suggestions?

Error ocсurrs when I try to open web site project in Microsoft Visual Studio 2012.

11条回答
叼着烟拽天下
2楼-- · 2019-02-01 16:12

The problem would be your project setup to be executed in the local IIS and the URL specified not exist.

There are options you can do to fix the problem.

Option 1 : (Use IIS Express)

1.) Open you web project .csproj file as XAML or in notepad.

2.) Find these properties and set according to your preferences.

UseIIS = false

UseIISExpress = true

and that's it.

Option 2 : (Use local IIS)

Follow the option 1 steps but change the following properties.

UseIIS = true

IISUrl = https://localhost

UseIISExpress = false

查看更多
孤傲高冷的网名
3楼-- · 2019-02-01 16:15
  1. Turn on windows features "Internet Information Services" in control panel.
  2. Open ".csproj" file and find
  3. Modify this line based on your requirements. http://localhost:777/
  4. Open the project/solution now
  5. If failed to load again, just right click the solution and select "Reload Project".
查看更多
冷血范
4楼-- · 2019-02-01 16:16

I've already found the solution. I just had to edit C:\Users\Administrator\Documents\IISExpress\config\applicationhost.config file, by adding my site to <sites> node.

查看更多
戒情不戒烟
5楼-- · 2019-02-01 16:19

I just went to the directory named in the error and renamed the applicationhost.config and restarted and VS created a new file and ran fine.

查看更多
forever°为你锁心
6楼-- · 2019-02-01 16:23

Not the exact same error, but I was lead to this answer since the first half of the error matched. Your applicationhost.config file may simply be read-only. Taking that off solved the error for me. That error calls out the file specifically though, so you should be able to find it easily.

查看更多
登录 后发表回答