访问localhost /时,IIS Express不承担localhost/index.html

use*_*284 5 iis visual-studio iis-express visual-studio-2013

如何让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
Run Code Online (Sandbox Code Playgroud)

我查看了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>
Run Code Online (Sandbox Code Playgroud)

在该<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>
Run Code Online (Sandbox Code Playgroud)

use*_*284 7

我添加了routes.IgnoreRoute(""); 在RouteConfig.cs中允许localhost /提供localhost/index.html.谁知道为什么这个有用?