首页 > 解决方案 > 在 IIS 上发布 ASP.NET MVC 应用程序

问题描述

我无法通过远程桌面在 IIS 上部署一个简单的应用程序。该应用程序是一个简单的“Hello World”网站,使用带有 MVC 模式的 ASP.Net(不是 .core),使用 Visual Studio 2017 开发。

我使用“文件系统”方式发布我的应用程序并将其上传到带有 IIS 10 的服务器(Windows Server 2016)。

这是我用来在 IIS 上发布我的应用程序的参数: IIS 配置

我有一个 HTTP 错误 403.14 但遵循这个主题(HTTP 错误 403.14 - 禁止 - Web 服务器配置为不列出此目录的内容)并在我的 web.config 中添加以下代码

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

我可以看到一个改进:我可以看到目录,但应用程序无法启动。 目录

如果我在 web.config 中使用以下代码,则会收到错误 403.14 - Forbidden

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

我究竟做错了什么 ?我没有主意。谢谢

标签: asp.netasp.net-mvcwindows-server-2012iis-10

解决方案


Please publish your application to some folder c:\pubfolder. Add a website in IIS and assign this folder c:\pubfolder to the physical path.

Note: You may need to give a host name in case if port 80 is already used (sometimes default website already uses port 80) .Remember you may need to give an entry in hosts file for the host name given above, the location of host file is C:\Windows\System32\drivers\etc . And no need to enable directory browsing.


推荐阅读