Failing to connect when IIS enables both Anonymous and Basic #2503

Closed
halter73 opened this Issue Sep 5, 2013 · 1 comment

Projects

None yet

3 participants

@halter73
Member
halter73 commented Sep 5, 2013

First request completes with status 200

GET http://localhost:81/signalr/negotiate?clientProtocol=1.3 HTTP/1.1
User-Agent: SignalR.Client.NET45/2.0.0.0 (Microsoft Windows NT 6.2.9200.0)
Host: localhost:81
Connection: Keep-Alive

Second request completes with status 401

GET http://localhost:81/signalr/connect?transport=serverSentEvents&connectionToken=PD63Uw3vImkQ5bkt4nX9zIBIk2RK56dMOVuxgJrFLBZ4Dplcn0Lknp5IbpToGgMKm6y38T3DM70Rn2rrICrchsNXEbJW42OsEVaPsN9FrzsKONzu6MK9m5UVsyVmemaF&connectionData=[%7B%22Name%22:%22AuthHub%22%7D] HTTP/1.1
User-Agent: SignalR.Client.NET45/2.0.0.0 (Microsoft Windows NT 6.2.9200.0)
Accept: text/event-stream
Host: localhost:81

Third request completes with status 500

GET http://localhost:81/signalr/connect?transport=serverSentEvents&connectionToken=PD63Uw3vImkQ5bkt4nX9zIBIk2RK56dMOVuxgJrFLBZ4Dplcn0Lknp5IbpToGgMKm6y38T3DM70Rn2rrICrchsNXEbJW42OsEVaPsN9FrzsKONzu6MK9m5UVsyVmemaF&connectionData=[%7B%22Name%22:%22AuthHub%22%7D] HTTP/1.1
User-Agent: SignalR.Client.NET45/2.0.0.0 (Microsoft Windows NT 6.2.9200.0)
Accept: text/event-stream
Authorization: Basic cmVkbW9uZFxndXN0YXZvYTpFa3ltaXphcmU3OVA=
Host: localhost:81

Error message on the last http response

[InvalidOperationException]: Unrecognized user identity.  The user identity cannot change during an active SignalR connection.
   at Microsoft.AspNet.SignalR.PersistentConnection.GetConnectionId(HostContext context, String connectionToken) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\PersistentConnection.cs:line 288
   at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\PersistentConnection.cs:line 208
   at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Hubs\HubDispatcher.cs:line 257
   at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\PersistentConnection.cs:line 153
   at Microsoft.AspNet.SignalR.Owin.Middleware.HubDispatcherMiddleware.ProcessRequest(OwinRequest request, OwinResponse response) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Owin\Middleware\HubDispatcherMiddleware.cs:line 27
   at Microsoft.AspNet.SignalR.Owin.Middleware.SignalRMiddleware.Invoke(OwinRequest request, OwinResponse response) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Owin\Middleware\SignalRMiddleware.cs:line 38
   at Microsoft.AspNet.SignalR.Samples.Startup.ClaimsMiddleware.Invoke(OwinRequest request, OwinResponse response) in d:\signalr\dev\samples\Microsoft.AspNet.SignalR.Samples\App_Start\Startup.cs:line 57
   at Microsoft.AspNet.SignalR.Owin.Middleware.SignalRMiddleware.Invoke(OwinRequest request, OwinResponse response) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Owin\Middleware\SignalRMiddleware.cs:line 23
   at Microsoft.AspNet.SignalR.Owin.Middleware.SignalRMiddleware.Invoke(OwinRequest request, OwinResponse response) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Owin\Middleware\SignalRMiddleware.cs:line 23
   at Microsoft.AspNet.SignalR.Owin.Middleware.SignalRMiddleware.Invoke(OwinRequest request, OwinResponse response) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Owin\Middleware\SignalRMiddleware.cs:line 23
   at Microsoft.AspNet.SignalR.Owin.Middleware.SignalRMiddleware.Invoke(OwinRequest request, OwinResponse response) in d:\signalr\dev\src\Microsoft.AspNet.SignalR.Core\Owin\Middleware\SignalRMiddleware.cs:line 23
   at Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.BeginEvent(Object sender, EventArgs e, AsyncCallback cb, Object extradata)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
   at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

#2145

@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 2, 2013
@NTaylorMullen NTaylorMullen Added connection data (hub subscriptions) to every request.
- This also involved moving the starting event above the negotiation logic instead of inside, this way connection data is built before the negotiate request.

#2503
ab3bd67
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 2, 2013
@NTaylorMullen NTaylorMullen Added tests to verify that connection data is passed with all requests.
- This also involved adding a ConnectionDataVerifierHub which checks requests to ensure that all requests contain the correct information associated with them.
- Also fixed some cherry-pick conflict issues that didn't translate correctly.

#2503
ecd32e4
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 2, 2013
@NTaylorMullen NTaylorMullen Addressed code review comments.
- This involved combining the addQs and addConnectionData into a singular method (prepareQueryString).
- Also modified addConnectionData to be private amongst the common js file.

#2503
4e907f8
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 3, 2013
@NTaylorMullen NTaylorMullen Added connection data (hub subscriptions) to every request.
- This also involved moving the starting event above the negotiation logic instead of inside, this way connection data is built before the negotiate request.

#2503
2e38cad
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 3, 2013
@NTaylorMullen NTaylorMullen Added tests to verify that connection data is passed with all requests.
- This also involved adding a ConnectionDataVerifierHub which checks requests to ensure that all requests contain the correct information associated with them.
- Also fixed some cherry-pick conflict issues that didn't translate correctly.

#2503
da9ddf6
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 3, 2013
@NTaylorMullen NTaylorMullen Addressed code review comments.
- This involved combining the addQs and addConnectionData into a singular method (prepareQueryString).
- Also modified addConnectionData to be private amongst the common js file.

#2503
123335d
@gustavo-armenta
Contributor

verified connectionData is sent on "/signalr/negotatie"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment