Can't connect to Visual Studio Online from any version of in VS: "The underlying connection was closed: An unexpected error occurred on a send."

Interesting one today.

 

PROBLEM
Customer reported not being able to connect to VSO from any VS version. Kept getting this:

The server returned the following error: TF400324: Team Foundation services are not available from server <ACCOUNT>.visualstudio.com\DefaultCollection. Technical information (for administrator): The underlying connection was closed: An unexpected error occurred on a send.

TROUBLESHOOTING

  • The customer could connect successfully using a web browser, so server-side was fine.
  • Following https://aka.ms/TFServiceVSConnection (the defacto guide for resolving this sort of thing) did not help.

RESOLUTION
Turns out he was using Kaspersky Endpoint Security and this was blocking the connection. Customer temporarily disabled Kaspersky Endpoint Security and then was able to connect from Visual Studio. He added an exception for *.visualstudio.com in the Web Anti-Virus policy settings of Kaspersky, re-enabled the protection and was able to connect. Looks like Kaspersky was blocking visualstudio.com on connections other than port 80.

HTH,
--Trevor