HTTP 错误 403.14 - 禁止 - Web 服务器配置为不列出此目录的内容

问题描述:

我刚刚在 Visual Studio 2012 中创建了一个新的空网站并单击了运行(即在浏览器中查看),但出现此错误:

I just created a new empty website in Visual Studio 2012 and clicked on run (i.e view in browser) and I get this error :

HTTP 错误 403.14 - 禁止Web 服务器配置为不列出此目录的内容.

我进入 IIS 并单击目录浏览,然后确保启用了目录浏览,但我仍然收到此错误.我想不通?

I went into IIS and clicked on Directory browsing and then ensured that Directory browsing was enabled but I still get this error. I can't figure it out ?

我刚刚创建的网站项目没有列在 IIS 管理器的默认网站中,我认为这很奇怪.

The website project I just created is not listed in Default web sites in IIS Manager which I thought was odd.

我如何摆脱这个错误?

将其保留到您的 Web 配置文件中,然后重命名 add value="yourwebformname.aspx"

keep this into your web config file then rename the add value="yourwebformname.aspx"

<system.webServer>
    <defaultDocument>
       <files>
          <add value="insertion.aspx" />
       </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
</system.webServer>

其他

<system.webServer>
    <directoryBrowse enabled="true" />
</system.webServer>