AzureSignalR-samples icon indicating copy to clipboard operation
AzureSignalR-samples copied to clipboard

Can' get the sample to work. 'Failed to start connection'

Open flowest opened this issue 7 years ago • 22 comments

When i follow the steps of "Build Your First Azure SignalR Service Application" tutorial, i get the following exception on running the web app:

Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[11]
      Failed to start connection. Error starting transport 'WebSockets'.
System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Net.Http.HttpRequestException: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer
bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat ---> System.Net.Sockets.SocketException: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
   at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
   at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync(Uri url, TransferFormat transferFormat)
   at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport(Uri connectUrl, HttpTransportType transportType, TransferFormat transferFormat)

(sorry for the german exception message in there, i don't know how to set them english)

Anyone else facing this problem?

flowest avatar May 18 '18 09:05 flowest

Can you share your application?

davidfowl avatar May 18 '18 09:05 davidfowl

Yes here is the link to my repo: https://github.com/flowest/AzureSignalRTest

flowest avatar May 18 '18 09:05 flowest

Is there a resolution to this? I started getting this recently...

bsampica avatar May 23 '18 12:05 bsampica

@flowest I tried your project and it works well. Anything else to share?

xscript avatar May 23 '18 14:05 xscript

@xscript Thanks for your work.

Basically thats all for me to share, becaus the sample just consits of the web app and the SignalR Service. The only thing i can imagine is the SignalR Service configuration.

Since this is a new Azure Service in preview, can you tell me where you set the location of the SignalR Service resource? I noticed it makes a difference where you locate your service in some cases if they are in preview (e.g. the Azure IoT Hub Events).

Otherwise i have no idea what i am doing wrong 😄

flowest avatar May 24 '18 06:05 flowest

For SignalR Service, all regions are the same. If you want to try, I am using Southeast Asia.

Could you share your service instance name so that I can checkout backend logs to see what happened? You can email it to kevinzha at microsoft.com

xscript avatar May 24 '18 07:05 xscript

@xscript

My instance name is “backplane”

bsampica avatar May 24 '18 08:05 bsampica

So I am using the Azure Signalr Service - I am running into a case where occasionally it works wonderful and other times the clients just get closed down before they even get into chat mode. The examples is as per the github examples with the obvious azure created signalr Service. Is there an underlying network issue causing the intermittent service on this. ?

ClientIco avatar May 25 '18 16:05 ClientIco

@bsampica I didn't see anything unusual for your instance. Let me investigate more .

@ClientIco How often do you see this happen? If not, how long does it last? Also how many servers do you have? Where do you host them?

xscript avatar May 26 '18 12:05 xscript

@xscript mine ist signalrfwl

flowest avatar May 28 '18 09:05 flowest

@xscript my issue ended up being related to using generic arguments in my hub class which busts things pretty good

bsampica avatar May 28 '18 09:05 bsampica

@bsampica Good to know you found the root cause.

@flowest Didn't see any external request. I guess there is something blocking outgoing traffic in your network. Could you check your firewall rules?

xscript avatar May 29 '18 14:05 xscript

I think am really starting to doubt if normal routing / not from our side / but between continents are causing major head aches. It will work in South Africa, then it will stop working in Australia, then occasionally it will work in Asia/Russia.... I would expect the path 2 azure would take specific and different routes which is prioritized when doing websockets - so far countries closest 2 USA have better success rate ? Anyone else experiencing the same issue ? Take note my azure signalr instance current resides in USA central

On Tue, 29 May 2018, 16:01 Kevin Zhao, [email protected] wrote:

@bsampica https://github.com/bsampica Good to know you found the root cause.

@flowest https://github.com/flowest Didn't see any external request. I guess there is something blocking outgoing traffic in your network. Could you check your firewall rules?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aspnet/AzureSignalR-samples/issues/22#issuecomment-392787710, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmA2lxu7qRxJeQ41QnuC1lGSC4UY0Jmks5t3VS4gaJpZM4UEbaO .

ClientIco avatar May 29 '18 14:05 ClientIco

I am having the similar error for ChatRoom sample. Here I opened a topic about details.

It looks pretty straightforward in the sample but I couldn't make neither console app or html part connect to SignalR Service on Azure. I encounter "No host is known" error.

mustafababil avatar Jun 06 '18 11:06 mustafababil

I made it running by creating a new SignalR service with a different name. Previous one was "mcbu" if it matters for investigation.

mustafababil avatar Jun 06 '18 13:06 mustafababil

@mustafababil Thanks for the detailed information! Looks like domain name binding failed when provisioning your first instance. Which region is the mcbu instance in?

xscript avatar Jun 06 '18 15:06 xscript

@xscript If I am not wrong, it was in US East. The new one is in US West.

mustafababil avatar Jun 06 '18 16:06 mustafababil

@mustafababil Yeah, we met some issue in US East region in the past couple of days. The domain name binding failed due to some reason. We have fixed it. So it shouldn't be a problem now.

xscript avatar Jun 08 '18 08:06 xscript

@flowest Do you still not be able to run the sample?

xscript avatar Jun 08 '18 08:06 xscript

@ClientIco Have you figured out the root cause? We would like to help out if you want.

xscript avatar Jun 08 '18 08:06 xscript

@xscript I just tried everything again from scratch, still no luck... Maybe the firewall is responsible for that

flowest avatar Aug 16 '18 13:08 flowest

@flowest Have you tried using different network?

xscript avatar Aug 22 '18 01:08 xscript