Setting Up Application Request Routing (ARR) on IIS: A Comprehensive Guide
Application Request Routing (ARR) is a powerful extension for Internet Information Services (IIS) that significantly enhances web server capabilities. By providing load balancing, SSL offloading, and URL-based routing, ARR enables you to build scalable and highly available web applications. This guide provides a detailed, step-by-step walkthrough of setting up ARR on IIS, complete with explanations, configuration options, and troubleshooting tips.
1. Installing ARR and Dependent Modules
ARR requires specific IIS roles and features. The most efficient way to install everything is using PowerShell (run as administrator):
Install-WindowsFeature Web-Server, Web-Common-Http, Web-Default-Doc, Web-Http-Errors, Web-Static-Content, Web-Http-Redirect, Web-Health, Web-Performance, Web-WebSockets, Web-App-Init, Web-Client-Auth, Web-Cert-Auth, Web-Filtering, Web-Stat-Compression, Web-Dyn-Compression, Web-Mgmt-Tools, Web-Mgmt-Console, Application-Request-Routing
This single command installs the Web Server role, necessary features, management tools, and Application Request Routing. After installation, restart IIS or the server. You can verify the installation in IIS Manager under “Server Farms.”
2. Creating and Configuring Server Farms
A server farm is a group of servers that ARR distributes traffic to.
Steps in IIS Manager:
- Open IIS Manager.
- Right-click “Server Farms” and select “Create Server Farm…”.
- Give your server farm a descriptive name (e.g., “WebFarm1”).
- Add the server addresses (e.g.,
192.168.1.2
,192.168.1.3
) of your backend servers. You can add servers by IP address or hostname. - Click “Finish.”
Key Server Farm Settings (Configurable after creation):
Setting | Description | Options/Considerations |
---|---|---|
Load balancing | Determines how requests are distributed among servers. |
|
Health Checks | Monitors the health of backend servers. |
|
Server Affinity | Maintains client sessions with the same server (sticky sessions). |
|
Caching | Configures caching of responses from backend servers. |
|
3. Configuring URL Rewrite for ARR
URL Rewrite is essential for directing traffic to the server farm and implementing URL-based routing.
Steps in IIS Manager:
- Select the website where you want to implement ARR.
- Open “URL Rewrite.”
- Click “Add Rule(s)…” in the “Actions” pane.
- Choose “Reverse Proxy” and click “OK.”
- In the “Inbound rules” section, enter the server farm name.
- Check “Enable SSL Offloading” if applicable.
- Click “OK.”
Example URL Rewrite Rule (web.config):
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://WebFarm1/{R:1}" />
</rule>
</rules>
</rewrite>
This rule forwards all requests to the “WebFarm1” server farm.
4. SSL Offloading
SSL offloading decrypts SSL traffic at the ARR server, reducing the load on backend servers. This is especially beneficial for CPU-intensive SSL operations.
Configuration:
- In IIS Manager, select your server farm.
- Open “SSL Settings.”
- Check “Enable SSL Offloading.”
- Ensure you have a valid SSL certificate bound to the website.
5. Monitoring and Logging
ARR provides detailed logging and monitoring capabilities.
Key Metrics to Monitor (using Performance Monitor):
- Requests per Second: Measures the rate of incoming requests.
- Current Connections: Shows the number of active connections to the server farm.
- Bytes Total/sec: Tracks the amount of data transferred.
- Failed Requests: Indicates the number of failed requests.
- Average Response Time: Measures the average time taken to process requests.
Logging:
ARR logs are located in %SystemDrive%\inetpub\logs\LogFiles
. Enable detailed logging for troubleshooting.
6. Advanced Configuration and Troubleshooting
- ARR Cache: Configure caching to further improve performance.
- Client Certificate Mapping: Map client certificates to backend servers for authentication.
- Troubleshooting 502 Errors: Check backend server availability, network connectivity, and application pool health.
- Troubleshooting 503 Errors: Check server farm health, application pool availability and queue length.
Conclusion
By following these steps, you can effectively set up and configure ARR on IIS to enhance the performance, scalability, and availability of your web applications. Remember to regularly monitor performance and adjust settings as needed.