在 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 管理器
- 在左侧连接树中右键单击您机器下的站点节点,然后单击添加网站
- 输入默认网站"作为网站名称
- 将应用程序池设置回DefaultAppPool!
- 将物理路径设置为
%SystemDrive%inetpubwwwroot
- 保留绑定,其他一切保持原样
- 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%inetpubwwwroot
- 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 :).您可以将绑定端口更改为例如8080 通过右键单击默认网站并选择编辑绑定...和编辑....有关详细信息,请参阅尝试在 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/".
The Web Application Project is configured to use IIS. The Web server 'http://localhost:8080/' could not be found.
在 IIS 管理器中重新创建默认网站后,我能够重新加载并打开该特定项目.
After I have recreated the Default Web Site in IIS Manager, I was able to reload and open that specific project.
这篇关于在 IIS 中重新创建默认网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!