Can't pass querystring when creating HubConnection #581

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

Comments

Projects
None yet
4 participants
@Lance772

Lance772 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

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Aug 6, 2012

Member

Do you get an exception?

Member

davidfowl commented Aug 6, 2012

Do you get an exception?

@Lance772

This comment has been minimized.

Show comment
Hide comment
@Lance772

Lance772 Aug 6, 2012

Check out this link to see the exception information.

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

Lance772 commented Aug 6, 2012

Check out this link to see the exception information.

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

@davidfowl

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Aug 6, 2012

Member

Unwrap the exception and look at the inner.

Member

davidfowl commented Aug 6, 2012

Unwrap the exception and look at the inner.

@Lance772

This comment has been minimized.

Show comment
Hide comment
@Lance772

Lance772 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)

Lance772 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

This comment has been minimized.

Show comment
Hide comment
@NTaylorMullen

NTaylorMullen Aug 6, 2012

Contributor

Can you send a repo?

Contributor

NTaylorMullen commented Aug 6, 2012

Can you send a repo?

@davidfowl

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Aug 6, 2012

Member

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

Member

davidfowl commented Aug 6, 2012

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

@Lance772

This comment has been minimized.

Show comment
Hide comment
@Lance772

Lance772 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.

Lance772 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

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Aug 7, 2012

Member

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

Member

davidfowl commented Aug 7, 2012

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

@Lance772

This comment has been minimized.

Show comment
Hide comment

Lance772 commented Aug 7, 2012

Yes.

@Lance772

This comment has been minimized.

Show comment
Hide comment
@Lance772

Lance772 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, "")

Lance772 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

This comment has been minimized.

Show comment
Hide comment
@oneroan

oneroan Aug 8, 2012

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

oneroan commented Aug 8, 2012

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

@davidfowl

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Aug 8, 2012

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");
Member

davidfowl commented Aug 8, 2012

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");

@ghost ghost assigned davidfowl Aug 8, 2012

@Lance772

This comment has been minimized.

Show comment
Hide comment
@Lance772

Lance772 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

Lance772 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

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Aug 8, 2012

Member

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

Member

davidfowl commented Aug 8, 2012

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

@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