I use Amazon Web Services’s Elastic Bean Stalk to automagically scale my ASP.Net web applications. I’m using a Windows 2012 R2 based instance.

I also use SignalR for real time communications within my app. While, I could use Ajax Long Polling, WebSockets are a tad bit faster.

Problem

The default AMI has doesn’t have the IIS Feature for WebSockets installed.

Solution

Create a folder in your project named .ebextensions.

If Visual Studio complains about not being allowed to add a folder with a leading dot, name the folder .ebextensions. and the period at the end will be removed for you.

Within the newly created .ebextensions folder, create a file, named whatever you want, ending in a .config extension. This is a YAML file, note that each level of indentation is two spaces.

I named mine InstallWebSocketsFeature.config.

1commands:
2  installWebSocketsFeature:
3    command: "%WINDIR%\\system32\\DISM.EXE /enable-feature /online /featureName:IIS-WebSockets"

Publish your package to EBS and you’ll now get a machine with the IIS WebSockets feature installed on creation of the instance.

UPDATE

Here is a list of all (most?) of the features available to install: The IIS 8.5 Module List