skv*_*ree 5 c# signalr cordova signalr-hub
来自 Fiddler 的内部错误:
The ConnectionId is in the incorrect format.
Run Code Online (Sandbox Code Playgroud)
来自跟踪:
SignalR.Transports.TransportHeartBeat Information: 0 : Connection 75e8d0ef-
64e2-463e-935d-a16759d948f1 is New.
SignalR.HubDispatcher Information: 0 : Failed to process connectionToken yhoTZnFsEnKUbd1/67eByQPhUb 3xkOsYMBXLLvp8nI29NnXrJE5zqHoFgLtA2VxOUJMAOreX6 7FGK4cGbal446Gs5YiV9F8MBduVMEXooL9fSeGpPHThvw56p6CzGX2yNmy7sy014gnak9l3BlZw==: System.FormatException: Invalid length for a Base-64 char array or string.
at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at Microsoft.AspNet.SignalR.Infrastructure.DataProtectionProviderProtectedData.Unprotect(String protectedValue, String purpose)
at Microsoft.AspNet.SignalR.PersistentConnection.TryGetConnectionId(HostContext context, String connectionToken, String& connectionId, String& message, Int32& statusCode)
Run Code Online (Sandbox Code Playgroud)
这是使用 Ripple 模拟器从 Apache Cordava 应用程序 (Visual Studio) 进行的客户端调用,我正在使用集线器,但它在 PersistentConnection 上失败了一些
http://localhost:4400/ripple/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=http%3A//localhost%3A52374/signalr/abort%3Ftransport%3DwebSockets%26clientProtocol%3D1.5%26connectionToken%3D6FHV%252BT%252F0WSoC3R8EEaseIe2481KxD24%252Fa31Toitf9kqUmIZw4jd87DgBnLWtVbLDZkZJA5gnEhQAUchyECh78738dIpuhqy1W4hAEVut%252F0gHr1Ou5bmpWbRi29sqRpwA4Y7Wc4WJPjYMpRIemgzP9w%253D%253D%26connectionData%3D%255B%257B%2522name%2522%253A%2522messagehub%2522%257D%255D HTTP/1.1
Host: localhost:4400
Run Code Online (Sandbox Code Playgroud)
我的代码:
The ConnectionId is in the incorrect format.
Run Code Online (Sandbox Code Playgroud)
我使用 Ripple 模拟器时遇到了同样的错误,并通过执行以下操作设法解决了该问题:
1:在客户端启用JSONP,更改以下内容
$.connection.hub.start()
Run Code Online (Sandbox Code Playgroud)
到
$.connection.hub.start({ jsonp: true })
Run Code Online (Sandbox Code Playgroud)
2. 在启动期间的配置方法中在服务器上启用 JSONP(我的例子是 C#)
app.MapSignalR(new HubConfiguration
{
EnableJSONP = true,
EnableJavaScriptProxies = true,
EnableDetailedErrors = true
});
Run Code Online (Sandbox Code Playgroud)