简体   繁体   中英

How to deploy a website to a local IIS

I'm trying to deploy a website to my local IIS for the first time

  1. I added a new website to my local IIS (also created a directory for it)
  2. I published it with File System method from VS2012 to this directory (checked - it's in there)
  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.

  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?

You need to grant permission to that folder.

When i deploy on IIS i grant "network service" read write access to the folder

You will need to launch the IIS Management Console and within the Default Website, your website folder should hopefully be listed. 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.

If it's an MVC app, then the default controller & action in the routing need to correspond with a controller & action in your app. By default this would be the Index action in HomeController. 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. do this by simply creating a default.aspx with some text in it & see if it's served when you browse the folder.

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. One of my colleagues added the following lines to the 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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