SignalR / SignalR

Incredibly simple real-time web for .NET
http://signalr.net
Other
9.17k stars 2.28k forks source link

the connection can not Countiue when run under a webproxy #1347

Closed wangchunlei closed 11 years ago

wangchunlei commented 11 years ago

I used .net 3.5 Client,it works fine without proxy. But when I update the app.config to use global proxy, the connection.start(ServerSentEventsTransport).wait() pending. I debuged,found that the "/signalr/negotiate" can return connectionId, but the next request "/signalr/connect?transport=serverSentEvents&connectionId=XXX" pending until timeout .

I do not know how to resolve that.

Hope you can give me some suggestions,thanks.

davidfowl commented 11 years ago

The .NET 3.5 client isn't supported anymore so I'm not sure what version of SignalR you're using. Did you set the proxy property on the client?

wangchunlei commented 11 years ago

My version is cloned from the release at December 28 (2012). I donnot set proxy , I debuged the server(iis7.5),that can get the request,but no response.

davidfowl commented 11 years ago

Did you try looking at fiddler?

wangchunlei commented 11 years ago

Yes,but fiddle cannot capture that.

davidfowl commented 11 years ago

I'm not sure what to tell you. Debug the source

wangchunlei commented 11 years ago

I can use IE visit the url(/signalr/connect?transport=serverSentEvents&connectionId=z)

Request Count: 1 Bytes Sent: 696 (headers:696; body:0) Bytes Received: 446 (headers:326; body:120)

ACTUAL PERFORMANCE

ClientConnected: 12:17:26.280 ClientBeginRequest: 12:17:34.579 GotRequestHeaders: 12:17:34.579 ClientDoneRequest: 12:17:34.579 Determine Gateway: 0ms DNS Lookup: 0ms TCP/IP Connect: 1ms HTTPS Handshake: 0ms ServerConnected: 12:17:34.579 FiddlerBeginRequest: 12:17:34.579 ServerGotRequest: 12:17:34.579 ServerBeginResponse: 12:19:43.024 GotResponseHeaders: 12:19:43.039 ServerDoneResponse: 12:19:43.039 ClientBeginResponse: 12:19:43.039 ClientDoneResponse: 12:19:43.039

Overall Elapsed:    0:02:08.460

RESPONSE BYTES (by Content-Type)

    ~headers~:  326

text/event-stream: 120

ESTIMATED WORLDWIDE PERFORMANCE

The following are VERY rough estimates of download times when hitting servers based in WA, USA.

US West Coast (Modem - 6KB/sec) RTT: 0.10s Elapsed: 0.10s

Japan / Northern Europe (Modem) RTT: 0.15s Elapsed: 0.15s

China (Modem) RTT: 0.45s Elapsed: 0.45s

US West Coast (DSL - 30KB/sec) RTT: 0.10s Elapsed: 0.10s

Japan / Northern Europe (DSL) RTT: 0.15s Elapsed: 0.15s

China (DSL) RTT: 0.45s Elapsed: 0.45s

Learn more about HTTP performance at http://fiddler2.com/r/?HTTPPERF

wangchunlei commented 11 years ago

This session is not yet complete. Press F5 to refresh when session is complete for updated statistics. Request Count: 1 Bytes Sent: 652 (headers:652; body:0) Bytes Received: 0 (headers:0; body:0)

ACTUAL PERFORMANCE

davidfowl commented 11 years ago

The request isn't supposed to end that's how signalr works. Try debugging the source code.

wangchunlei commented 11 years ago

Okey, url="/signalr/connect?transport=serverSentEvents&connectionId=..." HttpClient.GetAsync(url, req => { request = req; connection.PrepareRequest(request); request.Accept = "text/event-stream"; }).ContinueWith(task =>{}); the continuewith can never reach, until the timeout.

I don`t know which can cause that ,the client or the server?

davidfowl commented 11 years ago

The proxy might be buffering your responses. Try using the longpolling transport.

connection.Start(new LongPollingTransport());
wangchunlei commented 11 years ago

O,I try it

wangchunlei commented 11 years ago

Oh,it can connect when use LongPollingTransport,but after some seconds,the server call the disconnect....

davidfowl commented 11 years ago

You need to be a little more specific. I can't really help you out unless you give me more details.

wangchunlei commented 11 years ago

I debug the server and client,found that after some seconds first the client received the 502 error then the transport.IsAlive is false. // foreach (var metadata in _connections.Values) { if (metadata.Connection.IsAlive) { CheckTimeoutAndKeepAlive(metadata); } else { Trace.TraceInformation(metadata.Connection.ConnectionId + " is dead");

                    // Check if we need to disconnect this connection
                    CheckDisconnect(metadata);
                }
            }

can I ignore this error and not set the alive to false?

davidfowl commented 11 years ago

I have no idea what you're doing. I'm closing this bug. Trying to do a live debug session on this bug isn't going to happen.