signalr The connection id is in the incorrect format

冷暖自知 提交于 2019-12-29 09:18:09

问题


I have a project build from mvc4 c# razor engine. I added latest signalr nuget package 1.0.1 My project uses form authentication. each time the client goes from login to logout and vise versa I get an error on the client :

> "NetworkError: 500 Internal Server Error -
> http://myhost:51090/signalr/abort?transport=serverSentEvents&connectionToken=uIJvYLP3T0GdHaowIlS4uPDA19ukUy7TaW8dcXoPfma4Mr52uoe7PLK9Hh3ip17X_3RbFXx92yEa7nxYVHaCiRAWVE5e05vvpLD0_blb94eUwdkXbmhkRPM2_Z590A64VBF2-eLB_8wCWq-dmkkkbe6EqP6c9YXN3WRF5IyNYkB6Wkom7O1ZoDavQQ0UWvok0"

and in the server side :

 The connection id is in the incorrect format.

do I need to consider working with signalr in different way (from https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs) then with authentication ?


回答1:


It seems that you are logging out (modifying your user) while you have an active SignalR connection.

The reason why this is happening is because on the abort request on the server we check to see if the connectionId is associated with the correct user. Therefore logging out while the connection is still active results in you losing your user association and causing an error.

To fix this, stop the SignalR connection before logging out.



来源:https://stackoverflow.com/questions/15349043/signalr-the-connection-id-is-in-the-incorrect-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!