Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

asp.net mvc 4 - signalr The connection id is in the incorrect format

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...