在IIS中重新创建默认网站 [英] Recreate the default website in IIS
问题描述
我不小心删除了IIS中的默认网站;它不再出现在IIS管理器树中,浏览localhost会返回404错误。
I've accidentally deleted the default website in IIS; It no longer shows up in the tree of IIS manager and browsing "localhost" returns a 404 error.
我已重新安装IIS,但默认网站仍然没有不存在......是否可以重新创建默认网站,以便我可以在里面创建我的文件夹?
I've re-installed IIS, but the default website still doesn't exist... Is it possible to recreate the default website so I can create my folder inside?
推荐答案
其他答案是基本上是正确的,多亏了他们我能够恢复我的默认网站,他们只是遗漏了一些或多或少的重要细节。
Other answers are basically right, thanks to them I was able to restore my default web site, they're just missing some more or less important details.
这是完整的恢复过程在我的情况下默认网站(Windows 7 64位上的 IIS 7 ):
This was the complete process to restore the Default Web Site in my case (IIS 7 on Windows 7 64bit):
- 打开 IIS管理器
- 右键单击计算机下 Connections 树中的站点节点左侧并点击添加网站
- 输入默认网站作为网站名称
- 将应用程序池设置回 DefaultAppPool !
- 将物理路径设置为
%SystemDrive%\inetpub \ www.root
- 保留 Binding 以及其他所有内容
- open IIS Manager
- right click Sites node under your machine in the Connections tree on the left side and click Add Website
- enter "Default Web Site" as a Site name
- set Application pool back to DefaultAppPool!
- set Physical path to
%SystemDrive%\inetpub\wwwroot
- leave Binding and everything else as is
可能出现的问题:
-
如果新创建的网站无法启动,显示以下消息:
Internet信息服务(IIS)管理器 - 进程无法访问该文件,因为它正在被使用另一个过程。 (HRESULT的例外情况:0x80070020)
Internet Information Services (IIS) Manager - The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
... 端口80 可能已经分配给另一个应用程序(Skype在我的情况下:)。您可以将绑定端口更改为例如右键单击默认网站并选择编辑绑定... 和编辑... 。当您尝试在IIS 7.0中启动网站时,请参阅错误0x80070020 细节。或者,您当然可以关闭位于端口80上的应用程序。
...it's possible that port 80 is already assigned to another application (Skype in my case :). You can change the binding port to e.g. 8080 by right clicking Default Web Site and selecting Edit Bindings... and Edit.... See Error 0x80070020 when you try to start a Web site in IIS 7.0 for details. Or you can just close the application sitting on the port 80, of course.
某些应用程序需要默认网站拥有ID 1 。在我的情况下,它在娱乐后自动获得ID 1。如果不是您的情况,请参阅意外删除后在IIS中重新创建默认网站 。它与IIS 6和7不同。
Some applications require Default Web Site to have the ID 1. In my case, it got ID 1 after recreation automatically. If it's not your case, see Re-create "default Website" in IIS after accidentally deleting. It's different for IIS 6 and 7.
注意:我不得不重新创建默认网站,因为我甚至无法打开配置为在 Visual Studio 中的IIS下运行的项目。我有一个内部有几个项目的解决方案。其中一个项目无法加载,并显示以下错误消息:
Note: I had to recreate the Default Web Site, because I wasn't able to even open a project configured to run under IIS in Visual Studio. I had a solution with a couple of projects inside. One of the projects failed to load with the following error message:
Web应用程序项目配置为使用IIS。无法找到Web服务器 http:// localhost:8080 / 。
在IIS管理器中重新创建默认网站后,我能够重新加载并打开该特定项目。
After I have recreated the Default Web Site in IIS Manager, I was able to reload and open that specific project.
这篇关于在IIS中重新创建默认网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!