简体   繁体   中英

SignalR not working when deployed on remote machine

I developing a web chat application, and having a weird problem. the application is working fine on my local machine but just stuck on remote machine.

totally im lost, how to provide clue about my problem (please advice if there are trick to trace the problem), the only error i got from $.connection.hub.error is

Protocol error: Unknown transport.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Protocol error: Unknown transport.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[InvalidOperationException: Protocol error: Unknown transport.]
   Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) +866
   Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context) +174
   Microsoft.AspNet.SignalR.Owin.CallHandler.Invoke(IDictionary`2 environment) +628
   Microsoft.AspNet.SignalR.Owin.Handlers.HubDispatcherHandler.Invoke(IDictionary`2 environment) +222
   Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute() +55
   Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object extraData) +259

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result) +110
   Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.EndProcessRequest(IAsyncResult result) +7
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8836913
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

and here is what the console log provided.

SignalR: Negotiating with '<root_url>/signalr/negotiate'. jquery.signalR-1.0.0-rc2.js:54
SignalR: Attempting to connect to SSE endpoint '<root_url>/signalr/connect?transport=serverSentEv…2fc32a4&connectionData=%5B%7B%22name%22%3A%22xmppservicehub%22%7D%5D&tid=7' jquery.signalR-1.0.0-rc2.js:54
SignalR: EventSource timed out trying to connect jquery.signalR-1.0.0-rc2.js:54
SignalR: EventSource readyState: 0 jquery.signalR-1.0.0-rc2.js:54
SignalR: EventSource calling close() jquery.signalR-1.0.0-rc2.js:54
SignalR: This browser supports SSE, skipping Forever Frame. jquery.signalR-1.0.0-rc2.js:54
SignalR: SignalR: Initializing long polling connection with server. jquery.signalR-1.0.0-rc2.js:54
SignalR: Attempting to connect to '<root_url>/signalr/connect?transport=longPolling&…fc32a4&connectionData=%5B%7B%22name%22%3A%22xmppservicehub%22%7D%5D&tid=10' using longPolling. jquery.signalR-1.0.0-rc2.js:54
SignalR: Longpolling connected jquery.signalR-1.0.0-rc2.js:54
SignalR: Attempting to connect to '<root_url>/signalr?transport=longPolling&connecti…%7CS%2C1%7CT%2C0%7CQ%2C0&groups=%5B%22XmppServiceHub.howtodemo%22%5D&tid=2' using longPolling. jquery.signalR-1.0.0-rc2.js:54
SignalR: Attempting to connect to '<root_url>/signalr?transport=longPolling&connecti…%7CR%2C0%7CS%2C1%7CT%2C0&groups=%5B%22XmppServiceHub.howtodemo%22%5D&tid=8' using longPolling. jquery.signalR-1.0.0-rc2.js:54
SignalR: Attempting to connect to '<root_url>/signalr?transport=longPolling&connecti…%7CR%2C0%7CS%2C1%7CT%2C0&groups=%5B%22XmppServiceHub.howtodemo%22%5D&tid=5' using longPolling. jquery.signalR-1.0.0-rc2.js:54
SignalR: An error occurred using longPolling. Status = error. <html>
    <head>
        <title>Protocol error: Unknown transport.</title>

FYI:

  • Server side is a SignalR Hub with readonly session described here
  • Asp.Net MVC 4
  • IIS 6 Webserver

I'm lost about how to provide any clue, if those information not enough please tell me what info should i provide more.

EDIT

After update with the latest libs from nuget (version 1.0.0) i got the following eror (still the same console log, still working fine on local machine but on remote machine)

[ObjectDisposedException]: The CancellationTokenSource has been disposed.

Server stack trace: 
   at System.Threading.CancellationTokenSource.ThrowIfDisposed()
   at System.Threading.CancellationTokenRegistration.Dispose()
   at Microsoft.AspNet.SignalR.Infrastructure.CancellationTokenExtensions.<>c__DisplayClass6`1.<SafeRegister>b__1()
   at Microsoft.AspNet.SignalR.Infrastructure.DisposableAction.Dispose(Boolean disposing)
   at Microsoft.AspNet.SignalR.Infrastructure.DisposableAction.Dispose()
   at Microsoft.AspNet.SignalR.Transports.TransportHeartbeat.EndConnection(ConnectionMetadata metadata)
   at Microsoft.AspNet.SignalR.Transports.TransportHeartbeat.AddConnection(ITrackingConnection connection)
   at Microsoft.AspNet.SignalR.Transports.LongPollingTransport.ProcessRequest(ITransportConnection connection)
   at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context)
   at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context)
   at Microsoft.AspNet.SignalR.Owin.CallHandler.Invoke(IDictionary`2 environment)
   at Microsoft.AspNet.SignalR.Owin.Handlers.HubDispatcherHandler.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute()
   at Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object extraData)

Exception rethrown at [0]: 
   at Microsoft.Owin.Host.SystemWeb.Utils.<>c__DisplayClass1.<GetRethrowWithNoStackLossDelegate>b__0(Exception ex)
   at Microsoft.Owin.Host.SystemWeb.Utils.RethrowWithOriginalStack(Exception ex)
   at Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result)
   at Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Thanks in advance

SignalR does not support < IIS 7.

Edit: We do not support IIS < 7 but there are configurations that can be setup in order to support it.

It looks like your application is working but you're running into this issue here https://github.com/SignalR/SignalR/issues/1549 , it's been fixed in the next release.

Transport issue also come when you are providing Wrong Hub URL. Even if you add one extra forward slash at the end of URL this issue occurs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM