How to configure IIS 7 for localhost website?

☆樱花仙子☆ 提交于 2019-12-20 12:41:02

问题


I am new in Asp.Net

I have enabled features of IIS 7 on my windows system and able to see IIS manager.

I created an application but build/run application through visual studio it goes to browser and run the application with different port number. When i stop build/run application through visual studio and again i refresh browser application could not run.

I want to run application without visual studio. How to do this.

It gives this : http://localhost:9864/


回答1:


To configure IIS with a new website follow these instructions:

  1. Open IIS manager, right click Sites (At the right menu) and click Add Website

  1. Give the site a Site Name, The physical path on your machine, and a Host Name

    There are some conventions as for what website physical path to choose you can read about it in this SO question

  1. In Windows Explorer go to C:\Windows\System32\drivers\etc and Edit the hosts file

    Add this line at the end of the file:

    127.0.0.1 your-chosen-host-name-from-iis-ie-localhost.testsite.com

    And save the file

Thats about it. You can open your browser and browse the Host Name you chosen for your website or in IIS right click your site and click Manage Website - Browse

Important note

If you wish to use the same address as your VS uses (http://localhost:9864/) then on step 2 leave the Host Name textbox blank and instead change the Port textbox to your desired port (9864). In this case you can also ignore step 3.

As a site note:

If you installed IIS on your machine after the VS installation you might get some conflicts. You might be able by this stage to browse to static content as html but not .NET resources like aspx files. If by browsing to .NET files you get a message saying The page you are requesting cannot be served because of the extension configuration you can solve it with this SO question



来源:https://stackoverflow.com/questions/37777026/how-to-configure-iis-7-for-localhost-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!