【发布时间】:2013-12-17 17:28:50
【问题描述】:
如何让 localhost/ 指向 localhost/index.html?
直接访问 index.html 可以正常工作,但是访问站点根目录时,出现以下错误:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440
我查看了 IIS Express 配置文件 (%userprofile%\documents\iisexpress\config\applicationhost.config),但看不出有什么问题。
这是我项目的虚拟目录信息:
<site name="MySite" id="12">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\username\path\to\project\projectname" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:90210:localhost" />
</bindings>
</site>
在<system.webServer>部分,它包括:
<defaultDocument enabled="true">
<files>
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
【问题讨论】:
标签: visual-studio iis visual-studio-2013 iis-express