SteGriff

Blog

Next & Previous

Setting up IIS for the first time

Windows has a built-in webserver called Internet Information Services (IIS). It’s often switched off by default, but it’s easy to switch it on and use it to host a local website!

Getting IIS

Activating IIS in Windows Features

  1. Press the Start button or key
  2. Start typing ‘Windows features’
  3. Click ‘Turn Windows features on or off’
  4. Scroll to ‘Internet Information Services’ and expand it
  5. Drill down through ‘World Wide Web Services’, then ‘Application Development Features’, and check that at least the following things are switched on, as pictured to the right:
    • .Net Extensibility 3.5
    • .Net Extensibility 4.8
    • ASP.NET 3.5
    • ASP.NET 4.8
  6. Click OK and wait for Windows to finish adjusting

Configuring a site

  1. Hit start and type ‘IIS’ (perhaps pin it to your Start menu once you see it)
  2. In the left nav, expand your PC
  3. Right-click Sites and choose ‘Add Website…’
  4. Give the site a name (for your reference only)
  5. Choose the ‘Physical path’ of the site
    • Usually you would install your site in a directory within the C:\inetpub\wwwroot folder, like C:\inetpub\wwwroot\MyWebApplication
    • For an ASP.Net site, you should choose the level where you can see a ‘bin’ folder and probably a ‘Web.config’ file

Binding Option 1 - Bind to PC name, like ‘http://DESKTOP-123456’

Binding machine name

This is the easiest option if you just want people on your network to be able to hit your website.

First, find out your computer name (Hit start, type ‘Computer Name’, click whatever comes up, and look for Device/Computer/Machine name).

In IIS:

On another PC on the network, open a web browser to ‘http://DESKTOP-123456’

Hopefully your site comes up!

If you find that people on your network can’t get to your PC by its name, you may need to find out your LAN IP address and add a second binding:

In IIS:

Try from another PC to access ‘http://192.168.x.x’ or whatever your IP was.

Binding Option 2 - Bind to a DNS name

This is like having a domain for your website that only works on the local network.

It usually requires the network administrators to set up a DNS binding so that the local domain name points to the IP address of your PC.

However, on your local machine, you can fudge the domain to make it work just for you:

Add a line to the bottom of the file like this:

127.0.0.1	mysite.local

The IP on the left is the localhost address, leave it as-is. After the IP is a tab character, then the name you want to bind the site to.

In IIS:

Open a browser on your PC, and go to the new address. It should load the site.

On other people’s PCs, they would have to add the line to the hosts file for the address to work unless it has been configured on the network DNS by a network admin.

Wrap up

I hope this worked for you!

There is a less detailed, more visual guide on helpdeskgeek.

For way too much detail, you can read the Microsoft IIS docs.

If you get stuck, you can always Duck around for info online.