Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Websocket Android信号器,带有表单身份验证don´;t连接_Android_Asp.net_Websocket_Signalr_Signalr Hub - Fatal编程技术网

Websocket Android信号器,带有表单身份验证don´;t连接

Websocket Android信号器,带有表单身份验证don´;t连接,android,asp.net,websocket,signalr,signalr-hub,Android,Asp.net,Websocket,Signalr,Signalr Hub,这是我的塞纳里奥: 启用了FormsAuthentication的信号服务器,以及一个端点(WebAPI2),我可以在该端点上发布身份验证请求以获取身份验证票证(Cookie) Android应用程序将向该服务器发出身份验证请求,获取身份验证cookie,并使用该cookie作为身份验证用户连接到signalR HUB 使用服务器SentEventStranSport时,一切正常,客户端可以进行身份验证并连接到服务器,而不会出现问题 但是,当使用WebsocketTransport时,连接不会完

这是我的塞纳里奥:

启用了FormsAuthentication的信号服务器,以及一个端点(WebAPI2),我可以在该端点上发布身份验证请求以获取身份验证票证(Cookie)

Android应用程序将向该服务器发出身份验证请求,获取身份验证cookie,并使用该cookie作为身份验证用户连接到signalR HUB

使用服务器SentEventStranSport时,一切正常,客户端可以进行身份验证并连接到服务器,而不会出现问题

但是,当使用WebsocketTransport时,连接不会完成。原木波纹管显示其悬挂位置:

HubConnection - Creating hub proxy: messagehub
HubProxy MessageHub - Subscribe to event messageReceived
HubProxy MessageHub - Creating new subscription for: messagereceived
HubConnection - Entered startLock in start
: null
HubConnection - Start the connection, using AutomaticTransport transport
HubConnection - Start negotiation
: null
AutomaticTransport - Start the negotiation with the server
HubConnection - Getting connection data: [{"name":"messagehub"}]
HubConnection - Getting connection data: [{"name":"messagehub"}]
AutomaticTransport - Execute the request
Create new thread for HTTP Connection
Execute the HTTP Request
URL: http://www.voicenap.com/signalr/negotiate?clientProtocol=1.3&connectionData=%5B%7B%22name%22%3A%22messagehub%22%7D%5D&
VERB: GET
Header User-Agent: SignalR (lang=Java; os=windows 7; version=2.0)
CONTENT: null
Request executed
AutomaticTransport - Response received
AutomaticTransport - Read response data to the end
AutomaticTransport - Trigger onSuccess with negotiation data: {"Url":"/signalr","ConnectionToken":"gJYpQm9SxUDpk9mzxZkpn5VrojtfHdX4wiJovcDHR7yYttg4DVgpy9EU9JDNOKjndRhctwfCHvg7HFaTOAUZ5tdpi7wL8sq4me6TgRycPrvjxb3CfyEYMHK3nDQY/y7e","ConnectionId":"2c97c4e9-28dc-4ac0-9859-b73c6536d01b","KeepAliveTimeout":20.0,"DisconnectTimeout":30.0,"ConnectionTimeout":110.0,"TryWebSockets":true,"ProtocolVersion":"1.3","TransportConnectTimeout":5.0,"LongPollDelay":0.0}

HubConnection - Negotiation completed
HubConnection - ConnectionId: 2c97c4e9-28dc-4ac0-9859-b73c6536d01b
HubConnection - ConnectionToken: gJYpQm9SxUDpk9mzxZkpn5VrojtfHdX4wiJovcDHR7yYttg4DVgpy9EU9JDNOKjndRhctwfCHvg7HFaTOAUZ5tdpi7wL8sq4me6TgRycPrvjxb3CfyEYMHK3nDQY/y7e
HubConnection - Keep alive timeout: 20.0
HubConnection - Entered startLock in startTransport
HubConnection - Starting the transport
HubConnection - Starting transport for InitialConnection
HubConnection - Getting connection data: [{"name":"messagehub"}]
HubConnection - Getting connection data: [{"name":"messagehub"}]
有趣的是,如果我从我的
web.config
中删除
配置,连接将成功建立,但是没有身份验证数据(如预期的那样)

是否有人能够在需要身份验证和授权的集线器上使用WebSocket成功实现Android SignalR客户端(使用集线器上的Authorize属性)?如果是,如何


谢谢

我也有同样的问题。我已使用连接到信号服务器。服务器已设置窗体身份验证。 首先,我调用了常规api方法对用户进行身份验证并获取cookie,然后在每个请求中发送cookie。web套接字客户端的库本身只使用uri参数的构造函数。类别WebsocketTransport:

 mWebSocketClient = new WebSocketClient(uri);
为了使用cookie设置标头,我需要更改lib以使用此构造函数:

new WebSocketClient(uri,  new Draft_17(), headers, 0){...

其中头包含头Cookie。

我也遇到了同样的问题。我已使用连接到信号服务器。服务器已设置窗体身份验证。 首先,我调用了常规api方法对用户进行身份验证并获取cookie,然后在每个请求中发送cookie。web套接字客户端的库本身只使用uri参数的构造函数。类别WebsocketTransport:

 mWebSocketClient = new WebSocketClient(uri);
为了使用cookie设置标头,我需要更改lib以使用此构造函数:

new WebSocketClient(uri,  new Draft_17(), headers, 0){...
其中标头包含标头Cookie