IIS 8: Get started with IIS

Create a new Web server and a default site for configuration testing.

Jason Helmick

Buried deep within your Microsoft Server (versions 2008, 2008 R2 and 2012) is the most powerful Web server available. It’s just waiting for you to unleash its full potential. Whether your goal is to run a WordPress site from home or deploy and manage a large-scale, highly available Web farm for your company, IIS is up to the task.

To get started with IIS, you should have a “practice” server. This should be one you can trash over and over again without worrying about the consequences. It should be on its own network, safely isolated from your production environment. You can use Windows 8 on your laptop, but you should consider using a virtual machine (VM) for your testing. Use Hyper-V or even a simple VM on Windows Azure.

In this and successive articles, I’ll be using Windows Server 2012 with IIS 8. You can also use Windows 2008 or 2008 R2 (I’ll point out any important differences along the way). You should set up your VM as a domain controller with DNS. You’ll also want to make sure to have Windows PowerShell version 3 installed on your VM. If you haven’t started using Windows PowerShell, now would be a good time.

Quick installation

IIS is easy to install with the Server Manager graphical application. Select the Web Server role, and don’t add any additional features yet (I’ll explore those later). In a production environment, you shouldn’t add anything more than what you need for security reasons. For now, you’ll need only the minimum IIS install.

If you want to speed up the process and use Windows PowerShell, open an administrative Windows PowerShell console and type:

PS C:\> Install-WindowsFeature –Name Web-Server –IncludeManagementTools

Now I’ll discuss the changes that happen to the server during the installation. When IIS is installed, there are a few new additions to your server. There are five major changes you need to be aware of when working with IIS.

1. The first thing most people jump into is the IIS Manager. This is the graphical tool installed in your Administrative Tools folder. You’ll spend a considerable amount of time here, so it’s a good idea to get it started. When you launch the IIS Manager, it displays a navigational pane to the left with the Start Page selected along with an information box (see Figure 1).

The Start Page of the IIS Manager.

Figure 1 The Start Page of the IIS Manager.

  By selecting a different navigation node, such as your server, application pool or sites container, the tool changes its display and separates into three panes. The left pane is for Connections, the center pane is for the Features View and the Content View, and the right pane is for Actions (see Figure 2). Go ahead and explore the IIS Manager, but don’t make any changes yet.

Use Internet Information Services (IIS) Manager to manage a server or Web site.

Figure 2 Use Internet Information Services (IIS) Manager to manage a server or Web site.

2. There are changes to your file system to support the default Web site and other IIS storage needs, such as log files and customizable error messages. The installation creates the new path on your primary drive, C:\inetpub (see Figure 3).

There are a few file system additions after IIS installation.

Figure 3 There are a few file system additions after IIS installation.

  You’re not required to use this location when you create additional Web sites. In fact, it’s not generally recommended. However, you’ll need to know these folders to modify the default Web site and check log files.

3.

There are three new services added that run under IIS. You’ll find them listed in the Services Manager under Administrative Tools or by using the Windows PowerShell Get-Service cmdlet:

  • AppHostSvc: Application Host Helper Service
  • W3SVC: World Wide Web Publishing Service
  • WAS: Windows Process Activation Service

These services play a huge role in understanding how IIS works. For now, it’s sufficient to check that these services are running. Use the following Windows PowerShell command to do so:

PS C:\> Get-Service –Name AppHostSVC, W3SVC, WAS
4. There’s a new installed Windows PowerShell module named WebAdministration that contains cmdlets for Web management. You should confirm this module is present by typing:

PS C:\> Get-Module -ListAvailable
  This module is dynamically loaded into Windows PowerShell version 3 when you type a cmdlet. There will also be times when you need to load this module manually, especially for remote management. Here’s an example:

PS C:\> Import-Module –Name WebAdministration
  You can get a list of the Web management cmdlets for this module using Get-Help or Get-Command:

PS C:\> Get-Help *Web*
PS C:\> Get-Command –Module WebAdministration
5. Whether the WebAdministration module is manually imported or dynamically loaded, that launches a new Windows PowerShell provider. This creates a new file system drive named IIS. You’ll use this for administrative tasks and for getting information about your Web sites, so you should import the WebAdministration module and check out the new drive:

PS C:\> Get-ChildItem -Path IIS:

Explore the default Web site

Think of a Web server and the sites it hosts as a run-of-the-mill file server with network shares. With a file server, you share a directory off the file system, and give it a share name and permissions files to the directory for your users. When a user wants to open or use one of the files, he can type the UNC (\\ComputerName\ShareName) into an application such as File Explorer and open the files.

A Web server works the same way. You create a directory on the file system, add your files (Web pages) to the directory, and create a Web site to share those pages to the world. A Web site gets its “Share name” from something called a “binding” that’s configured for that Web site.

The IIS installation process creates the default Web site for you. It also creates a new directory, C:\inetpub\wwwroot, and adds a handful of basic files (Web pages). The Web site  named “Default Web Site” is created with a binding of “*:80 (http).” This means any HTTP request to port 80 will be directed to the Default Web Site. You can view this information in the IIS Manager. You could also use Windows PowerShell (see Figure 4).

Viewing the settings of Default Web Site.

Figure 4 Viewing the settings of Default Web Site.

There are two ways to view information about the default Web site—or any other Web site, for that matter—using Windows PowerShell. They are the Get-Website cmdlet and the IIS: provider method:

PS C:\> Get-Website –Name 'Default Web Site'
PS C:\> Get-Childitem –Path IIS:\Sites

The IIS: provider method is preferable because you can also get a quick list of the all the files and additional Web site components by adding the Web site name to the path:

PS C:\>Get-ChildItem –Path 'IIS:\Sites\Default web site'

Test the default Web site

The default Web site is good to have around for testing, so don’t delete it. It’s a great way to check that the Web server is working and receiving HTTP requests. To test the default Web site, open a browser and type the site name. In this case, the binding is for all port 80 requests, so here’s the URL:

https://<ServerName>:80

Because port 80 is a default in your browser, you don’t need to type that—but doing so will help you see that a URL contains the server name and the share name (Web site binding), just like a UNC.

Want to change your default Web page to something else? Open Notepad.exe and type “TechNet Rocks!” and save the file to C:\inetpub\wwwroot as Default.htm (you could also try it this way with Windows PowerShell):

PS C:\> Add-Content -Path C:\inetpub\wwwroot\Default.htm -Value "TechNet Rocks!"

Open your browser and type the URL for the default Web site or with Windows PowerShell:

PS C:\> Start iexplore https://<servername>

You now have your own Web page on your own Web server. Now you’re probably starting to ask a lot of questions: “Can I move the default Web site? How do I create my own Web sites? How do I configure DNS for my Web site?” All these questions, plus many more, will be answered in forthcoming articles about IIS.

Jason Helmick

Jason Helmick is  the director of Windows PowerShell technologies for Interface Technical Training, based in Phoenix, Ariz. He’s a speaker, author, teacher and inadvertent IIS administrator.