Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure IIS 7 for localhost website?

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/

like image 249
Manish Tiwari Avatar asked Jun 12 '16 17:06

Manish Tiwari


People also ask

How configure localhost in IIS?

Go to Control Panel > Administrative Tools > Internet Information Services (IIS) Manager. In the Connections panel, expand your host tree, right-click on Sites, and choose Add Website. Enter the new website's name and choose the location. Enter the Host name.

How do I access IIS website locally?

Open run (windows key + R) and type inetmgr and press enter or in Cortana Search type IIS. IIS Manager opens.


1 Answers

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

like image 64
Jaqen H'ghar Avatar answered Sep 28 '22 07:09

Jaqen H'ghar