How to install WebSocket Protocol support in IIS through PowerShell‘s Install-WindowsFeature cmdlet. Simply install and enable support for the WebSocket protocol on Windows Server IIS.

Install Web-WebSockets feature with PowerShell to enable WebSocket support

About WebSocket:

One of the limitations to HTTP is that it was designed as a one-directional method of communication. However, many modern web-based applications require more real-time, two-way communications in order to function optimally. With the release of Windows Server 2012 and Windows 8, Internet Information Services (IIS) 8.0 has added support for the WebSocket Protocol.

The WebSocket Protocol is an open standard that is defined in RFC 6455, and developers can use this functionality to create applications that implement two-way communications over the Internet between a client and server.

You can use the following PowerShell command to easily install the Web-WebSockets feature in IIS:

PS C:\Users\UserName> Install-WindowsFeature -name Web-WebSockets

A second way to install the Web-WebSockets feature in IIS, is to use the Deployment Image Servicing and Management (DISM) command. Enable the Web-WebSockets feature:

%SystemRoot%\system32\dism.exe /online /enable-feature /featurename:IIS-WebSockets

Enable .NET 4.5 Windows Communication Foundation (WCF) in IIS 8

In addition, it is recommended to install and enable Windows Communication Foundation (WCF) web services in IIS 8, with .NET 4.5.

This may interest you:   RewriteProxy with .htaccess in IIS

You then need to install the HTTP Activation feature:

PS C:\Users\UserName> Install-WindowsFeature -name NET-HTTP-Activation
PS C:\Users\UserName> Install-WindowsFeature -name NET-WCF-HTTP-Activation45

Instead of PowerShell, you can use DISM for this too (of course ;-) ).

“Server Error in MultipleBindings Application” Windows Communication Foundation error

When you’ve installed the IIS features NET-HTTP-Activation and NET-WCF-HTTP-Activation45, but you receive the following Server Error:

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection."

Then you may have forgotten to enable multipleSiteBindingsEnabled in your web.config file.

Or when that freaking .NET web service returns:

TypeLoadException: Could not load type 'System.ServiceModel.Activation. HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Then you’ll need to add a *.svc handler if the IIS web server feature installation failed to do so.

How to ist all installed Windows Server Features using PowerShell Get-WindowsFeature cmdlet

PowerShell provides the means to list & verify installed Windows Server Features with the Get-WindowsFeature cmdlet. Here is how to list all installed Windows Server features, sorted by name:

# list all INSTALLED Windows Server features
Get-WindowsFeature `
  | where {$_.Installed -eq "True"} `
  | ft DisplayName, Installed
Get-WindowsFeature `
  | where {$_.Installed -eq "True"} `
  | ft Name, Installed

See Leonid Shirmanov’s post querying for Windows Server Features using PowerShell ServerManager Module for more information and examples.