Can't pass querystring when creating HubConnection #581

lance00 opened this Issue Aug 6, 2012 · 14 comments


None yet

4 participants

lance00 commented Aug 6, 2012

When creating a new hubconnection I'm passing a querystring to be used as the connectionID. Using IConnectionIdGenerator works fine however the HubConnection faults as soon as I Start. Without the querystring, Start works fine. Not sure what's wrong?

Dim test As New Dictionary(Of String, String)
test.Add("test", "one")
hubConnection = New HubConnection(My.Settings.PrintServerURL, test)

                                                       If task.IsFaulted Then
                                                       End If
                                                   End Sub).Wait()

Do you get an exception?

lance00 commented Aug 6, 2012

Check out this link to see the exception information.


Unwrap the exception and look at the inner.

lance00 commented Aug 6, 2012

Ah here it is. Along with the stack trace.

at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at SignalR.Client.Http.HttpHelper.<>c__DisplayClass2.b__0(IAsyncResult ar)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)


Can you send a repo?


Looks like you're getting a 404, could you look at fiddler or some kind of http tracing.

lance00 commented Aug 7, 2012

Yes. It's not finding "/negotiate" 404 - File or directory not found.
I'm using Server 2012 RC and IIS 8. Must be something I'm overlooking.


@lance00 does it work if you don't set the querystring?

lance00 commented Aug 7, 2012


lance00 commented Aug 7, 2012

Actually to clarify. If I don't use a querystring, it works. If I just don't set it to a value, still get the error.

hubConnection = New HubConnection(ServerURL)

'Does not work
Dim test As New Dictionary(Of String, String)
hubConnection = New HubConnection(ServerURL, test)

'Also does not work
hubConnection = New HubConnection(My.Settings.PrintServerURL, "")

oneroan commented Aug 8, 2012

I have the same question.
conn = new HubConnection(_url, "a=b")
it doesn' work!!!


We have a bug in our logic that builds the url. We'll fix this for 0.5.3. If you want to work around it for now you can append /signalr to the url:

var connection = new HubConnection("http://myserver/signalr", "a=b");
@davidfowl davidfowl was assigned Aug 8, 2012
lance00 commented Aug 8, 2012

By adding "/signalr". I don't get the fault on the client now but the QueryString is not coming through at the server. I stepped through the following code on the server so I know it's being called, but the QueryString has no values?

Imports SignalR

Public Class ConnectionFactory Implements IConnectionIdGenerator

Public Function GenerateConnectionId(request As IRequest) As String Implements IConnectionIdGenerator.GenerateConnectionId
    Return request.QueryString(0)
End Function

Public Sub New()
End Sub
End Class

That's by design. The connection id is supposed to be generated on the server and should be unique per connection.

@davidfowl davidfowl added a commit that closed this issue Aug 8, 2012
@davidfowl davidfowl Fixed url creation when using custom query strings when using HubConn…

- Added 2 more overloads to the HubConnection ctor to support using the default url.
- Added test.

Fixes #581
@davidfowl davidfowl closed this in 59de15e Aug 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment