Can't pass querystring when creating HubConnection #581

Closed
lance00 opened this Issue Aug 6, 2012 · 14 comments

Projects

None yet

4 participants

@lance00
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)

                hubConnection.Start().ContinueWith(Sub(task)
                                                       If task.IsFaulted Then
                                                           MessageBox.Show("Fault")
                                                       End If
                                                   End Sub).Wait()
@davidfowl
Member

Do you get an exception?

@lance00
lance00 commented Aug 6, 2012

Check out this link to see the exception information.

https://www.sugarsync.com/pf/D6874229_7413919_455807

@davidfowl
Member

Unwrap the exception and look at the inner.

@lance00
lance00 commented Aug 6, 2012

Ah here it is. Along with the stack trace.

https://www.sugarsync.com/pf/D6874229_7413919_457636

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)

@NTaylorMullen
Contributor

Can you send a repo?

@davidfowl
Member

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

@lance00
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.

@davidfowl
Member

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

@lance00
lance00 commented Aug 7, 2012

Yes.

@lance00
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.

'Works
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
oneroan commented Aug 8, 2012

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

@davidfowl
Member

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
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
@davidfowl
Member

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…
…ection.

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

Fixes #581
59de15e
@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