简体   繁体   English

如何将网站部署到本地 IIS

[英]How to deploy a website to a local IIS

I'm trying to deploy a website to my local IIS for the first time我第一次尝试将网站部署到本地 IIS

  1. I added a new website to my local IIS (also created a directory for it)我在本地 IIS 中添加了一个新网站(也为它创建了一个目录)
  2. I published it with File System method from VS2012 to this directory (checked - it's in there)我用 VS2012 的文件系统方法将它发布到这个目录(检查 - 它在那里)
  3. I clicked Manage WebSite > Browse我点击了管理网站 > 浏览
  4. This shows an error:这显示一个错误:

    HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. HTTP 错误 403.14 - 禁止 Web 服务器配置为不列出此目录的内容。

  5. I found on the web that I should enable Directory Browsing.我在网上发现我应该启用目录浏览。 I tried it.我尝试过这个。
  6. Now it shows me my app root directory instead of loading the web app (that's not what I wanted...)现在它向我显示了我的应用程序根目录,而不是加载网络应用程序(这不是我想要的......)
How to make IIS launch my web app? 如何让 IIS 启动我的网络应用程序?

You need to grant permission to that folder.您需要授予该文件夹的权限。

When i deploy on IIS i grant "network service" read write access to the folder当我在 IIS 上部署时,我授予对文件夹的“网络服务”读写访问权限

You will need to launch the IIS Management Console and within the Default Website, your website folder should hopefully be listed.您将需要启动 IIS 管理控制台,在默认网站中,您的网站文件夹应该会被列出。 Do a right click on the website folder and click "Convert to Application"右键单击网站文件夹,然后单击“转换为应用程序”

You may want to consider using Web Deploy as it will simplify the deployment process.您可能需要考虑使用 Web 部署,因为它将简化部署过程。

If it's an MVC app, then the default controller & action in the routing need to correspond with a controller & action in your app.如果它是一个 MVC 应用程序,那么路由中的默认控制器和操作需要与您的应用程序中的控制器和操作相对应。 By default this would be the Index action in HomeController.默认情况下,这将是 HomeController 中的 Index 操作。 If your default is some other combination, change the defaults in the routing config.如果您的默认值是其他组合,请更改路由配置中的默认值。

If you have a home/index controller/action, then check your server is configured to run aspx pages.如果您有主页/索引控制器/操作,请检查您的服务器是否配置为运行 aspx 页面。 do this by simply creating a default.aspx with some text in it & see if it's served when you browse the folder.通过简单地创建一个包含一些文本的 default.aspx 并查看它是否在您浏览文件夹时提供。

Directory Browsing should be disabled, as it would allow someone to browse the files on your server.目录浏览应该被禁用,因为它允许某人浏览您服务器上的文件。 I know it's your localhost, but good practice & all that.我知道这是您的本地主机,但良好的做法和所有这些。

I finally found it.我终于找到了。 It wasn's an IIS problem.这是一个IIS问题。 One of my colleagues added the following lines to the Web.config我的一位同事在 Web.config 中添加了以下几行

<system.webServer>
    <handlers>
        <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
        <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
        ...
    </handlers>
    ...
</system.webServer>

Removing them fixed the problem.删除它们可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM