Why SignalR does not use WebSockets?

 

As you probably know SignalR supports multiple transports. The favor one and most powerful one is of course WEBSOCKET transport. 
Unfortunately this transport cannot be always used in any infrastructure. When your application is started the client side of SignalR will check what transports are supported. 
Interestingly there is a similar check at the server side.

For example, if you see following request

POST /Daenet.MySpy/signalr/signalr/send?transport=foreverFrame&connectionId=cd17bb01-23de-4181-97da-6514b9bbb58e HTTP/1.1

which is responded by following response, it means that web socket transport is not supported. If infrastructure does not support streaming SIgnalR will use fallback transport. In a case of Internet Explorer this will be foreverFrame as shown above. 
To be sure that the server is not the problem, try to find out the request like following one:

GET /Daenet.MySpy/signalr/signalr/connect?transport=webSockets&connectionId=cd17bb01-23de-4181-97da-6514b9bbb58e&connectionData=%5B%7B%22name%22%3A%22trackerhub%22%7D%5D&tid=6 HTTP/1.1

If this request has failed with error 500 it means that the server does not support websockets. In this specific case server means the server (IIS) supports WebSockets, but ASP.NET version of your application which hosts SignalR does not support websockets. 
It sound wired, buiit is not. If the server does not support WebSockets (for example Windows Server 2008) you will never get error 500 back. The client will switch to fallback transport automatically. This error is related to ASP.NET. 
To fix it you need following in the web.config:

<system.web>

<compilation debug="true" targetFramework="4.5"/> 
   <httpRuntime targetFramework="4.5"/> 
   <pages controlRenderingCompatibilityVersion="4.0"/> 
</system.web>

http://localhost/MySpy/signalr/signalr/connect?transport=webSockets&connectionId=829cc336-a32c-457a-b539-fca7744fda09&connectionData=%5B%7B%22name%22%3A%22trackerhub%22%7D%5D&tid=7

Why SignalR does not use WebSockets?的更多相关文章

  1. [机翻] WIRER ON THE WIRE - SIGNALR协议的非正式描述

    原文 原文很简单,以下为机翻 WIRER ON THE WIRE - SIGNALR协议的非正式描述 我已经看到询问有关SignalR协议的描述的问题出现了很多.哎呀,当我开始关注SignalR时,我 ...

  2. SignalR系列续集[系列8:SignalR的性能监测与服务器的负载测试]

    目录 SignalR系列目录 前言 也是好久没写博客了,近期确实很忙,嗯..几个项目..头要炸..今天忙里偷闲.继续我们的小系列.. 先谢谢大家的支持.. 我们来聊聊SignalR的性能监测与服务器的 ...

  3. SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=》提升)

     SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=>提升,5个Demo贯彻全篇,感兴趣的玩才是真的学) 官方demo:http://www.asp.net/si ...

  4. C# BS消息推送 SignalR介绍(一)

    1. 前言 本文是根据网上前人的总结得出的. 环境: SignalR2.x,VS2015,Win10 介绍 1)SignalR能用来持久客户端与服务端的连接,让我们便于开发一些实时的应用,例如聊天室在 ...

  5. ASP.NET SignalR入门

    前言 之前在培训ASP.NET WebAPI的时候有提过SignalR这个技术,但当时只是讲了是用来做什么的,并没有多说.因为自己也是画图找资料的时候见到的.后来当一直关注的前端大神贤心发布LayIM ...

  6. 常见的Web实时消息交互方式和SignalR

    标签: WebSocket SignalR 前言 1. Web消息交互技术 1.1 常见技术 1.2 WebSocket介绍 1.3 WebSocket示例 2. Signal 2.1 SignalR ...

  7. Asp.NET MVC 使用 SignalR 实现推送功能一(Hubs 在线聊天室)

    简介       ASP .NET SignalR 是一个ASP .NET 下的类库,可以在ASP .NET 的Web项目中实现实时通信.什么是实时通信的Web呢?就是让客户端(Web页面)和服务器端 ...

  8. 使用SignalR实现消息提醒

    Asp.net SignalR是微软为实现实时通信的一个类库.一般情况下,SignalR会使用JavaScript的长轮询(long polling)的方式来实现客户端和服务器通信,随着Html5中W ...

  9. SignalR 实现Web多人聊天室

      ASP .NET SignalR 是一个ASP .NET 下的类库,可以在ASP .NET 的Web项目中实现实时通信.什么是实时通信的Web呢?就是让客户端(Web页面)和服务器端可以互相通知消 ...

随机推荐

  1. SQL中Merge的用法

    SQL中Merge的用法 Merge的用法 Merge可以完成以下功能: 1.  两个表之间数据的更新 2.  进行进销存更新库存 3.  进行表之间数据的复制 语法说明: 1.  在语句结束后一定要 ...

  2. jquery表单实时验证

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. leetcode第一刷_Word Ladder II

    这道题非常难. 之前的题目我提到过一次用两个vector来做层序遍历的,就是由于这道题.要想最后恢复出单词变换的路径,就须要事先保存,依据dp中路径恢复的启示,保存的应该是一个单词的前一个变换节点.可 ...

  4. 开源消息中间件DotNetMQ

    由于这个开源项目对我这种中间件菜鸟很有帮助,因此,我将官方的说明文档翻译如下: Introduction In this article, I will introduce a new and ind ...

  5. spring04 spel注入

    1.创建需要的实体类对象 public class Student { //学生实体类 private String name; //姓名 private Integer age; //年龄 priv ...

  6. Html.RenderPartial和Html.RenderAction的区别

    添加一个PartialController控制器 using System; using System.Collections.Generic; using System.Linq; using Sy ...

  7. Java类与类之间关系总结

    继承,依赖,关联,聚合,组合 一般来说依赖和关联是类似的,关联是强依赖,聚合和组合是一类,组合属于强聚合. 继承:一般是子类和父类之间的关系,关键字extends 依赖:可以这样记忆,做某件事必须要依 ...

  8. C#里巧用DateTime预设一些可选的日期范围(如本年度、本季度、本月等)

    //大家在做报表或查询的时候都会有给用户预设一些可选的日期范围(如上图)                //如本年度销售额.本季度利润.本月新增客户                //C#里内置的Da ...

  9. Ubuntu 11.10 安装GMONE3,卸载 UNITY和UNITY 2D

    Ubuntu 11.10安装GNOME3: 1)sudo apt-get install gnome-shell    sudo apt-get install gnome-themes*   (或者 ...

  10. 第一次启动MySQL时报错

    [root@localhost~]#/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mys ...