Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.Net "No server available" error #279

Closed
tomasmcguinness opened this issue Nov 27, 2018 · 6 comments
Closed

ASP.Net "No server available" error #279

tomasmcguinness opened this issue Nov 27, 2018 · 6 comments

Comments

@tomasmcguinness
Copy link

I have a simple SignalR setup on ASP.Net (.Net 4.6.2). When using a local SignalR server, my JS client connects without issue.

However, when I change from app.MapSignalR() to app.MapAzureSignalR(GetType().FullName) I can't seem to get my JS client connected at all. Here is a screenshot of the output from console.

image

I'm not doing anything more than trying to connect.

I'm using Microsoft.AspNet.SignalR 2.4.0-preview2-20181018-02

How can I fix this issue?

@vicancy
Copy link
Member

vicancy commented Nov 28, 2018

"No server available" indicates that your app server has trouble connecting to Azure service. You can enable tracing from the app server side with the following to see if any error throws.

GlobalHost.TraceManager.Switch.Level = SourceLevels.Information;

A sample here: https://github.com/Azure/azure-signalr/blob/dev/samples/AspNet.ChatSample/AspNet.ChatSample.SelfHostServer/Startup.cs#L19

If you are local debugging the server side, you can also uncheck "Just My Code" and break when any CLR exception throws:
image
image

@tomasmcguinness
Copy link
Author

Thanks for the quick reply. I've debugged locally and caught some exceptions when opening the webpage with the SignalR client.

Here are the ones I caught:

System.Security.Authentication.AuthenticationException: "A call to SSPI failed, see inner exception."
- (inner) "The function requested is not supported"

System.ObjectDisposedException: 'Safe handle has been closed'

System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'

System.Net.WebSockets.WebSocketException: 'Unable to connect to the remote server'
- (inner) WebException: The request was aborted: Could not create SSL/TLS secure channel.

The AuthenciationException is the one that occurs the most frequently.

Does this help shed any light on the issue?

@vicancy
Copy link
Member

vicancy commented Nov 28, 2018

Azure Service only support TLS1.2 for security concerns.
Please add following code to your Startup:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

@tomasmcguinness
Copy link
Author

Thank! I tried that myself and it has solved it.

I thought ..NET 4.6 defaulted to TLS 1.2, so I got that wrong.

Thanks!

@spooky
Copy link

spooky commented May 15, 2019

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

does this switch the protocol type system wide? if so, is there a way to limit this switch just for signalr?

@spooky
Copy link

spooky commented May 28, 2019

targeting .net 4.7 in web.config also works and doesn't require forcing TLS 1.2 in code (provided that it can be negotiated)
related link: https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls#if-your-app-targets-net-framework-47-or-later-versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants