What is Windows IIS ?

RohitRohit
5 min read

Internet Information Services (IIS) is a powerful, flexible, and secure web server platform from Microsoft, designed to host websites, web applications, and services. As a component of Windows Server, IIS offers integration with Microsoft's ecosystem, making it a preferred choice for hosting websites and applications developed in ASP.NET, .NET Core, or other Microsoft technologies. It also supports PHP, Python, and a variety of other web development languages, making it versatile.

IIS provides various essential features for web hosting, including:

  1. Security:

    • Windows Authentication: IIS can integrate with Active Directory for secure user authentication.

    • IP and Domain Restrictions: Restrict access based on IP addresses.

    • SSL/TLS Support: Secure your websites with HTTPS.

  2. Application Pools: IIS allows you to isolate web applications in individual application pools. This enhances security and performance by running each application in its own process.

  3. Logging and Diagnostics: IIS provides detailed request logs, event tracing, and tools like Failed Request Tracing (FREB) to help diagnose performance or functionality issues.

  4. Modules and Extensions: IIS is modular, allowing you to add or remove features based on your needs. It supports extensions for additional functionality like URL rewriting, compression, caching, and more.

  5. Load Balancing and High Availability: IIS supports load balancing to distribute traffic across multiple servers, improving scalability and reliability.

  6. Easy Integration with .NET: It integrates seamlessly with the .NET framework and supports running ASP.NET applications, making it a preferred platform for Microsoft-based development.

  7. Scripting Language Support: IIS supports multiple scripting languages, including PHP, Python, Node.js, and Ruby, making it versatile for different development stacks.


Installing IIS

Before getting into configurations, you need to install IIS. IIS is not installed by default on Windows, so you need to enable it through the "Windows Features" control panel or via PowerShell.

Method 1: Using the Windows Features GUI

  1. Open the Control Panel and navigate to Programs > Turn Windows features on or off.

  2. In the Windows Features window, locate Internet Information Services.

  3. Check the box next to it, and click OK.

  4. Windows will install the necessary IIS files.

Method 2: Using PowerShell

For automation or command-line enthusiasts, you can install IIS using PowerShell:

Install-WindowsFeature -name Web-Server -IncludeManagementTools

This command will install IIS along with the management tools needed to configure it.


Configuring IIS

Once installed, IIS is ready to serve websites, but there are several configurations you may need to customize depending on your needs.

Managing Websites

IIS organizes websites into sites. Each site can have its own hostname, IP address, and port number.

  1. Default Website: IIS installs with a "Default Web Site" that listens on port 80 (HTTP). You can test your IIS installation by visiting http://localhost in your browser.

  2. Adding a New Website: To host a new website, follow these steps:

    • Open IIS Manager.

    • In the left-hand Connections pane, right-click Sites and select Add Website.

    • Provide a Site Name and set the physical path to the folder containing your website files.

    • Assign an IP address and port (or leave the default of 80 for HTTP).

    • Click OK.

  3. Binding a Site to a Domain Name: In the Site Bindings section of IIS Manager, you can assign hostnames (domain names) to your site. This allows IIS to serve different sites based on the domain requested.

Application Pools

Each IIS website runs in an Application Pool, which is an isolated container for your web application. Application pools enhance security by preventing one website from affecting another.

  1. Creating an Application Pool:

    • Open IIS Manager and click Application Pools in the left-hand pane.

    • Right-click in the middle pane and select Add Application Pool.

    • Provide a name for the pool and select the appropriate .NET CLR version (if applicable).

    • Click OK.

  2. Assigning a Website to an Application Pool: When adding a new website, you can select an existing application pool or create a new one.

  3. Recycling Application Pools: IIS can automatically recycle (restart) application pools to avoid memory leaks or other issues. You can configure this in the Recycling settings for each pool.


Security in IIS

Security is a top priority in any web hosting environment. IIS offers various features to secure your sites:

SSL/TLS Configuration

To secure your websites with HTTPS:

  1. Obtain an SSL certificate from a trusted Certificate Authority (CA) or create a self-signed certificate for internal testing.

  2. In IIS Manager, select your site and click Bindings in the right-hand pane.

  3. Add a new binding for port 443 (HTTPS) and select your SSL certificate.

Authentication Options

IIS supports several authentication methods:

  1. Windows Authentication: Use this when your users are within the same domain or network, allowing seamless Single Sign-On (SSO).

  2. Basic Authentication: This is suitable for scenarios where you need a simple login prompt.

  3. Anonymous Authentication: Allows public access to your site without requiring user authentication.

  4. Forms Authentication: Ideal for custom web applications, where users log in via a web form.

IP Restrictions

You can restrict access to your site based on IP addresses. In IIS Manager:

  1. Select your site, and open the IP Address and Domain Restrictions feature.

  2. Add IP addresses or ranges that are allowed or denied access.


Performance Optimization in IIS

  1. Output Caching: IIS allows caching of dynamic content, which can improve the performance of websites with heavy traffic.

  2. Compression: Enable Dynamic and Static Compression in the IIS Manager to reduce the size of the content sent to clients, improving load times.

  3. HTTP/2 Support: IIS supports HTTP/2, which can significantly improve website load times by allowing multiplexed connections and header compression.

  4. Load Balancing: IIS can be set up in a network load-balanced (NLB) cluster to distribute traffic across multiple servers.


Monitoring and Diagnostics

  1. Request Logs: IIS can generate detailed logs for all incoming requests. These logs are essential for monitoring traffic and diagnosing issues.

  2. Failed Request Tracing (FREB): This tool helps troubleshoot specific issues by capturing detailed information about failed requests.

  3. Performance Monitoring: Integrate IIS with Performance Monitor to keep an eye on server resources such as CPU, memory, and network usage.

0
Subscribe to my newsletter

Read articles from Rohit directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rohit
Rohit

I'm a results-driven professional skilled in both DevOps and Web Development. Here's a snapshot of what I bring to the table: ๐Ÿ’ป DevOps Expertise: AWS Certified Solutions Architect Associate: Proficient in deploying and managing applications in the cloud. Automation Enthusiast: Leveraging Python for task automation, enhancing development workflows. ๐Ÿ”ง Tools & Technologies: Ansible, Terraform, Docker, Prometheus, Kubernetes, Linux, Git, Github Actions, EC2, S3, VPC, R53 and other AWS services. ๐ŸŒ Web Development: Proficient in HTML, CSS, JavaScript, React, Redux-toolkit, Node.js, Express.js and Tailwind CSS. Specialized in building high-performance websites with Gatsby.js. Let's connect to discuss how my DevOps skills and frontend expertise can contribute to your projects or team. Open to collaboration and always eager to learn! Aside from my work, I've also contributed to open-source projects, like adding a feature for Focalboard Mattermost.