If you are using Signal R and and Signal R Hub as part of an ASP.net application which sits behind the loadbalancer with more than one machine then there is possiblity that you will start seeing this below error
SignalR – The connection id is in the incorrect format.
Just like when load balancing an ASP.NET website that uses Session, SignalR instances which are load balanced requires that all servers which handle SignalR requests must share a machine key. This is not mentioned in any documentation for SignalR/. ConnectionToken is encrypted using the machine key, when an application hits server 1 it is assigned a connectionToken generated using that machine’s machine key. If the application then hits server 2 with that assigned connectionToken, machine 2 cannot decrypt the token unless is has a matching machine key.
To solve this issue in your application web.config file you can add the machine key configuration
Now you must be wondering how can generate these keys, IIS manager helps you to generate those keys
- Open IIS Manager, host you are application website on the IIS, click on the site, then on the Features view tab, select machine key as shown below
- After selecting machine keys you will see following default options
- Uncheck all the checkboxes and on the right side tab click on the “Generate Keys” option.
- Post generating the keys, Click on apply, this will add the machine key configuration web site web.config file as shown above.