A self hosted application doesn't seem to run off of IIS, so does it require a specific operating system in order to enable web sockets on the server side?
相关问题
- ASP.NET display progress bar during post back
- Can I use SignalR in my Winform c# app?
- signalR and large data transfer [closed]
- Why does an idle SignalR connection have 4-6 Mbps
- SignalR Client - The remote server returned an err
Yes it requires windows server 2012 check the quote below from SignalR Supported Platforms
Also a good read on why can be found here
Browsers will support it because they have implemented the protocol internally, most browsers won't use the operating system transport libraries so they will be able to make use of WebSockets even if the OS does not directly support it.
HTTP.SYS prior to Windows 8/2012 has no built in support for WebSockets, so although .NET 4.5 contains WebSocket classes, they won't work unless you are running .NET 4.5+ on Windows 8/2012 and that will affect self-hosting solutions running in Windows < 8.
The implementation resides in the operating system code that .NET and IIS8 just leverages. The .NET classes simply wrap calls through to HTTP.SYS so it will throw an exception on an operating system that does not have underlying support for it.
When self-hosting you can however use your own internal Web Socket server such as Fleck and tell SignalR that you in fact do support Web Sockets regardless of your OS.
Start a Fleck server in your self-hosted application (examples on their site) and as an example you can do this for a PersistentConnection self-host:
Disclaimer: This is an undocumented feature, the developers of SignalR have told me that this may not be possible in future versions of the library. Keep in mind that you will also need to cater for keep-alives and serializing your data to JSON so it plays nice with the SignalR clients. It still works in version 1.1.3.
I've know for sure that websockets are not supported now by doing a quick test. I created a self hosted hub and then a quick jquery client. On my windows 8 machine the querystring showed websockets, on the server 2008 r2 it showed long polling...