SignalR websockets连接无法正常工作

时间:2014-01-22 21:11:01

标签: signalr

当我点击索引页面时,SignalR尝试通过websockets与服务器通信 - 太棒了!可悲的是,没有任何请求通过,并且websocket在5秒后超时而不会失败,之后它会回退到另一个协议并开始工作。

[15:36:52 GMT-0500 (Eastern Standard Time)] SignalR: Negotiating with '/signalr/negotiate?connectionData=%5B%7B%22name%22%3A%22api%22%7D%5D&clientProtocol=1.3'. jquery.signalR-2.0.1.min.js:8
[15:36:52 GMT-0500 (Eastern Standard Time)] SignalR: Connecting to websocket endpoint 'ws://xxx/signalr/connect?transport=webSockets&connectionToken=J4E8avsT4D%2BUrtfdAKgYufE%2B9pdPiYy5VHPqDP1qKa1DN%2FSAXkykC0B9N6VKWZxUM3UWnfoHmFtqU2nMKVW%2FNoCUIvYilyz2S1Yg%2FpsGrMHIlj0GaGCAW2BHeK9XsgI1&connectionData=%5B%7B%22name%22%3A%22api%22%7D%5D&tid=6'. jquery.signalR-2.0.1.min.js:8
[15:36:52 GMT-0500 (Eastern Standard Time)] SignalR: Websocket opened. jquery.signalR-2.0.1.min.js:8
[15:36:57 GMT-0500 (Eastern Standard Time)] SignalR: webSockets timed out when trying to connect. 

我完全不知道发生了什么事。据我所知,一切都已正确设置。以下是我的配置设置。

设定:

  • Windows Server 2012
  • IIS 8
  • 安装了IIS Websockets
  • .NET 4.5

的软件包:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="AngularJS.Core" version="1.2.9" targetFramework="net45" />
  <package id="jQuery" version="1.10.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.SignalR" version="2.0.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.SignalR.Core" version="2.0.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.SignalR.JS" version="2.0.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin" version="2.0.2" targetFramework="net45" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="2.0.2" targetFramework="net45" />
  <package id="Microsoft.Owin.Security" version="2.0.2" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
  <package id="Owin" version="1.0" targetFramework="net45" />
</packages>

的Web.config:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

0 个答案:

没有答案