- A proxy server/firewall/IPS
- Sleeping or hibernating a system
- NuGet
- A combination of the above
Proxy Server/Firewall/Intrusion Prevention System
If you’re connecting through a proxy server, a firewall or there’s an intrusion prevention system of some type involved, the error will occur at random while you’re actively connected.
If a firewall or intrusion prevention system is involved, you may need to contact your network administrator and whitelist the host name and/or IP address of your server. You can find the server name in the Account Information page in the DiscountASP.NET TFS Control Panel and if you need the IP address, please open a request with the Technical Support department using the Support Portal.
In the event that you’re connecting through a proxy server, you may want to review the connection settings on your workstation by:
- Disconnect from your TFS server.
- Open Internet Options through the Windows Control Panel or through Internet Explorer (Tools > Internet Options).
- Click on the “Connections” tab and then the “LAN settings” button.
- Try un-checking the “Use a proxy server for your LAN” option.
- Reconnect to the server to see if the problem persists.
Sleep/Hibernate
In some cases, if your workstation is put to sleep or into hibernation with Visual Studio running, after Windows comes out sleep/hibernation, trying to perform a source control action causes the error.
The problem is usually resolved by restarting Visual Studio and reconnecting to the server or just restarting the system completely.
NuGet
One of the unexpected reasons why the error seems to be occurring is because the installation, update, or un-installation of a NuGet Package causes the authentication-related error. If you’re using NuGet, I would highly recommend checking out: “Fixing combination of NuGet and Team Foundation in workgroup configuration: 401 Unauthorized” that was published by Miha Markic for detailed information and a resolution.