Skip to content

.NET client fails auto-negotiation fallback #1125

Closed
Epstone opened this Issue Dec 12, 2012 · 3 comments

3 participants

@Epstone
Epstone commented Dec 12, 2012

System: Opensuse 11.4, Mono 2.10.9, Apache 2.2.17
Signalr dev branch source from yesterday
Szenario
Website A and B running on the same server. The JS Client works already with the Hub on B.
http://admin.riedme.de/chat.htm

Site A uses the .NET Client to send a Message to the Hub running on B and gets the following exception:

System.AggregateException: One or more errors occured ---> System.OperationCanceledException: 
The connection was stopped before it could be started. --- End of inner exception stack trace --- at  
System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken 
cancellationToken) [0x000b5] in /usr/src/packages/BUILD/mono-2.10.9/mcs/class/corlib
/System.Threading.Tasks/Task.cs:608 at System.Threading.Tasks.Task.Wait () [0x00000] in /usr/src
/packages/BUILD/mono-2.10.9/mcs/class/corlib/System.Threading.Tasks/Task.cs:556 at 
ShoppingMapMVC.Controllers.HomeController.CallAdminPage () [0x00000] in :0 --> (Inner 
exception 0) System.OperationCanceledException: The connection was stopped before it could be 
started.

Client Code (inside Home Controller / Index Method)

var url = SiteConfig.AdminSiteUrl;
var connection = new HubConnection(url);

var url = SiteConfig.AdminSiteUrl;
Logger.Debug(url);
var connection = new HubConnection(url);
IHubProxy hub = connection.CreateHubProxy("AdminHub");
connection.Start().Wait();
hub.Invoke("Send", new { Date = DateTime.UtcNow.ToString("o"), SpamInfo = "This is from the main page" });

Hub Code

public class AdminTask
{
    public DateTime Date { get; set; }
    public string SpamInfo { get; set; }
}

public class AdminHub : Hub
{
    public void Send(AdminTask task)
    {
      // Call the addMessage method on all clients            
      Clients.All.addMessage(task);
    }
}

On windows with the VS Dev Server, no exception is thrown and the code works as expected.
Thanks in advance!

@davidfowl
SignalR member

This bug actually has nothing to do with mono. Renaming the title.

@davidfowl davidfowl was assigned Dec 12, 2012
@davidfowl
SignalR member

Fixed in e143941

@gustavo-armenta

verified by doing this on server side, it takes client 2 secs to fallback to longpolling

    protected override Task OnConnectedAsync(IRequest request, string connectionId)
    {
        string transport = request.QueryString["transport"];
        if (transport != "longPolling")
        {
            throw new Exception();
        } 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.