SignalR和ARR:InvalidOperationException:不是有效的Web套接字请求

时间:2013-10-25 17:54:19

标签: asp.net sockets ssl signalr arr

我正在将SignalR库用于Web套接字。在我们的开发机器上进行测试时,以及从生产服务器本身调用时,一切都很有效。

但是,尝试从公用计算机连接时,我们收到500内部服务器错误。在与我们的基础设施人员交谈之后,区别在于生产服务器位于反向代理后面,使用应用程序请求路由器3.0将所有端口80请求转发到443。

我挖出了应用程序服务器日志,错误是:

Exception information: 
Exception type: InvalidOperationException 
Exception message: Not a valid web socket request.
at Microsoft.AspNet.SignalR.Transports.WebSocketTransport.AcceptWebSocketRequest(Func`2 callback)
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context)
at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context)
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

与该错误相关的请求信息是:

Request information:   
Request URL: https://www.mydomain.com:443/signalr/connect?transport=webSockets&connectionToken=l/KfYPkMHDqQnu7szK/64cmtobTUr1913ZXQP444gvbIux8lpt+p/M4IJ9xoEUGyxsMAqo/l683g4juH/WShFBxyAKN2/qbSv21mN72zGuw9J3BFgNqYSXwokLxXsAeH&guid=0000000134470724&connectionData=[{"name":"mainhub"}]&tid=0 
Request path: /signalr/connect 
User host address: 192.***.*.*** 
User:  
Is authenticated: False 
Authentication Type:  "

从Chrome开发工具控制台获取的相同信息记录以下内容:

WebSocket connection to 

wss://www.mydomain.com/signalr/connect?transport=webSockets&connectionToken=b0fWQ9u5Rk3TvGKrvqUUyae0ro8wRGaBqc4TcoaOOTg9Son%2B63BuL1HPlEidKyo%2B1HrdNoAFK9EwD5KLw5hDlKZdvGMZGy6IZdtJ2me7bTGJ%2BWIWwx3UNtrGNt%2B4VblN&guid=0000000545496499&connectionData=%5B%7B%22name%22%3A%22mainhub%22%7D%5D&tid=9

failed: Unexpected response code: 500 

有趣的是,跟踪侦听器说连接开始,然后关闭。

[3568] SignalR.ChatHub.OnConnected GUID : 0000000554281914, with connectionID : 5c6789fb-7dfd-4b93-9039-2e2ea888ccfb  <-  this is my tracing in OnConnected to spit out the connectionID
[3568] SignalR.Transports.TransportHeartBeat Verbose: 0 :   
[3568] Connection 5c6789fb-7dfd-4b93-9039-2e2ea888ccfb exists. Closing previous connection. 

上面的描述显示:

  1. 建立与Hub的连接,代码到达 Hub.OnConnected(),

  2. 的覆盖方法
  3. 关闭相同的连接ID。 (但是不会调用Hub.OnDisconnected的覆盖。)

  4. 以下评论编辑,关于使用的技术:

      

    SignalR 2.0。

         

    IIS 8

         

    Windows Server 2012。

         

    ARR 3.0。 [将请求转发到端口80到443]

0 个答案:

没有答案