IIS (Internet Information Services) · Advanced Operations

WebSockets

Chat, live dashboards and notifications keep a WebSocket connection open. IIS needs one feature installed to allow it.

Advanced 5 min Lesson 41 of 45Covers IIS 10 on Windows Server 2019/2022/2025 and Windows 10/11.
Before you start:Hosting ASP.NET Core
0/45 in IIS
On this page · 5 min · Advanced

Learning objectives#

  • Install the WebSocket Protocol feature
  • Check the webSocket configuration
  • Proxy WebSockets with ARR
  • Avoid connections being dropped

Explanation#

Install Web Server → Application Development → WebSocket Protocol. Without it, ASP.NET Core SignalR silently falls back to slower Server-Sent Events or long polling.

The section system.webServer/webSocket (Configuration Editor) has enabled = true by default once installed. Don’t disable it in web.config.

For a back end behind IIS (Node.js, Kestrel on another port), ARR 3 forwards WebSocket upgrades through a normal reverse proxy rule.

Load balancers and proxies close idle connections (often after 60–120 seconds). SignalR sends keep-alive pings; for raw WebSockets send your own pings.

Step-by-step screens#

Drawings of IIS Manager in IIS 10 (Windows Server 2019/2022, Windows 10/11). The red numbers match the numbered actions under each picture; names on your computer will differ.

Loading pictures…

Code example: Check in the browser which transport SignalR uses#

C#Program.cs Illustrative
builder.Services.AddSignalR();
var app = builder.Build();
app.MapHub<OrdersHub>("/hubs/orders");
app.Run();


// In the browser console (F12) of the page that connects:
//   [2026-11-26T10:20:01Z] Information: WebSocket connected to wss://shop.example/hubs/orders?id=...
// If you see "ServerSentEvents connected" instead, the WebSocket Protocol feature is missing.
Expected output
With the feature installed the browser log shows “WebSocket connected to wss://…”, and the Network tab shows a 101 Switching Protocols response.

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. The hub is mapped at /hubs/orders.
  2. The SignalR client tries WebSockets first.
  3. 101 Switching Protocols confirms the upgrade.
  4. A fallback transport means IIS isn’t allowing WebSockets.

Real-world use case#

An order dashboard showed new orders with a delay of several seconds. Installing the WebSocket Protocol feature switched SignalR from long polling to WebSockets and updates became instant.

Common mistakes#

Feature not installed

Everything “works” with a fallback, just slower and with more requests. Check the transport.

Idle timeouts on the load balancer

Connections drop every minute. Use keep-alives and raise the idle timeout.

Best practices#

  • Install WebSocket Protocol
  • Check for 101 in DevTools
  • Use sticky sessions or a backplane with several servers
  • Configure keep-alives

Remember this#

Role service: WebSocket Protocol.

101 Switching Protocols = success.

ARR 3 proxies WebSockets.

Practice exercise#

Your task: Which HTTP status code confirms a successful WebSocket upgrade?

Show solution
Text Illustrative
101 Switching Protocols

Mini quiz#

WebSockets quizMultiple choice Question 1 of 1

What happens to SignalR if IIS lacks WebSocket support?

Score so far: 0/0

Want more? Practise all IIS MCQs · IIS interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.