39

I am behind a corporate proxy server which requires credentials. I have been trying to connect to a TFS server (on tfspreview.com) with MS Visual Studio Pro 2012 for the last 2 hours with no success. Every attempt has been met with this error:

enter image description here

The integrated browser works fine when I initiate it. It asks me for my proxy login credentials and once entered, off I go. So there is some different method of connection happening here.

I have also navigated to the TFS server, and once in my project I clicked Open new instance of Visual Studio. The new instance fails with this message in the output:

HTTP code 407: Proxy Authentication Required

I have tried everything that I found on another post to no avail. I have made every edit and combination edits to devev.exe.config that I have found with no success.

Could it be that the 2010 version is somehow different than the 2012 Pro edition? I am running Windows 7.

Can anyone shed some light? Please?

Note: This problem also applies to Visual Studio 2013

Community
  • 1
  • 1
gillytech
  • 3,595
  • 2
  • 27
  • 44

13 Answers13

87

After three days of searching, the solution fell into my lap.

Now, what happened was VS tried to do an automatic update but was stopped by the proxy. I was prompted for credentials and the check took place.

I was inspired to check the TFS server connection just for kicks in case that prompt would possibly establish a connection for the TFS server to tunnel through... lo and behold! It worked!

WORKAROUND:

  1. Open TOOLS>Extensions & Updates
  2. Click on Updates... in the left-hand menu
  3. There will be a failure notice on screen and a link to enter your credentials. Click it and enter them.
  4. Close the Extension manager.
  5. Click TEAM>Connect to TFS server...
  6. Enter the address and it will work!

Note: Some have suggested trying to use the proxy credential prompt by opening the integrated browser but this has not worked. I am not an expert but I think they are connecting through different channels within windows itself.

There is no editing of devenv.exe.config required for this to work.

It will be a pain to have to check for updates manually every time you need to connect to the server, but this is the best solution I have come up with until Microsoft fixes this issue permanently with an update or future release.

gillytech
  • 3,595
  • 2
  • 27
  • 44
  • 5
    I had EXACTLY the same problem and your solution worked for me. Thanks!!! PD:fu·$&· proxies .... – Ignacio Soler Garcia Feb 07 '13 at 11:48
  • 1
    When cloning a git repo for the first time behind a proxy this error occurs: 'An error occurred. Detailed message: An error was raised by libgit2. Category = Net (Error). An error occurred while sending the request.' For everyone googling that error, this is a solution to that for VS2013. – JacobD Jul 24 '14 at 07:10
  • 1
    Worked without any issue. Thanks – Octane Mar 16 '15 at 07:20
  • 1
    Didn't work for me. Still happens all the time behind a proxy and using vs2013 – TombMedia Mar 25 '15 at 19:18
  • 1
    Perfectly Worked for me with Visual Studio 2013. Thanks – Sheikh M. Haris Aug 16 '16 at 08:58
  • 1
    Cheers. @gillytech – Zbidi Mar 31 '17 at 12:31
  • 1
    this is really old but you are a genius!! I would never figure this kind of things all by myself!! – break7533 May 01 '18 at 09:40
  • 1
    `There will be a failure notice on screen and a link to enter your credentials. Click it and enter them.` I don't have this option. but when i do `TEAM>Connect to TFS server.` then it's automatically ask the credential to login and then it **works** – Ramesh Rajendran May 17 '18 at 05:50
28

The situation is essentially that VS is not set up to go through a proxy to get to the resources it's trying to get to (when using FTP). This is the cause of the 407 error you're getting. I did some research on this and there are a few things that you can try to get this debugged. Fundamentally this is a bit of a flawed area in the product that is supposed to be reviewed in a later release.

Here are some solutions, in order of less complex to more complex:

  • If possible don't use the proxy for the specified domains that you're trying to get to.
  • Set up your proxy settings correctly Internet Explorer (even if you don't use it) as that affects system wide settings. Even go so far as to connect to the internet with internet explorer and leave it connected then go back and try again from VS.
  • In the devenv.exe.config add <servicePointManager expect100Continue="false" /> as laid out below:
  • <configuration>
      <system.net>
        <settings>
          <servicePointManager expect100Continue="false" />
        </settings>
      </system.net>
    </configuration>
    

  • Add defaultProxy settings as follows:
  • <system.net>
      <defaultProxy useDefaultCredentials="true" enabled="true">
          <proxy proxyaddress="http://your.proxyserver.ip:port"/>
      </defaultProxy>
      <settings>
      ...
    

  • Alternately you could try telling it to use system default (which should pull from internet explorer) like so:
    <defaultProxy useDefaultCredentials="true" enabled="true">
        <proxy usesystemdefault="True" />
    </defaultProxy>
    

  • There is an older solution involving creating a plugin here
  • Hope this solves it for you.

    Peter Oram
    • 6,213
    • 2
    • 27
    • 40
    • 2
      Hi Peter, thanks for the suggestions but this has not handled the problem. Unfortunately I may have to accept the fact that this is just not possible. – gillytech Dec 06 '12 at 21:13
    • 2
      +1 ... worked for me. (usesystemdefault is the correct casing!) – satnhak Feb 26 '14 at 13:19
    • 1
      +1 old post, i know. but the problem is not fixed and will probably stay forever. adding the worked for me. I still get some sort of error, but the connection to TFS works fine now. – Pasoe Jul 24 '14 at 06:36
    • Not using TFS outside our firewall but just wanted to connect for updates. The worked for me. – Tony D Oct 21 '14 at 21:20
    • Voila! It worked! Far better than tweaking every time trying to connect TFS – Avishek May 05 '15 at 13:06
    • This worked on connecting to a **Visual Studio Online** service from my Visual Studio 2013 Pro. Great!!!!! – hiFI Sep 10 '15 at 06:29
    8

    While running Visual Studio 2012 behind a proxy, I received the following error message when checking for extension updates in the Visual Studio Gallery:

    The remote server returned an unexpected response: (417) Expectation failed

    A look around Google finally revealed a solution here:

    Visual Studio 2012 Proxy Settings

    http://www.jlpaonline.com/?p=176

    Basically, he's saying the fix is to edit your devenv.exe.config file and change this:

    <settings>      
       <ipv6 enabled="true"/> 
    </settings>
    

    to this:

     <settings>
       <ipv6 enabled="true"/>      
       <servicePointManager expect100Continue="false"/> 
     </settings> 
    
    Yack
    • 1,400
    • 1
    • 10
    • 13
    7

    The solution that worked for me in both Visual Studio 2013 and Microsoft Test Manager (MTM) was to ensure that both devenv.exe.config and mtm.exe.config included this configurations section:

    <system.net>
        <settings>
            <ipv6 enabled="true"/>
            <servicePointManager expect100Continue="false"/>
        </settings>
        <defaultProxy useDefaultCredentials="true" enabled="true">
            <proxy usesystemdefault="True" />
        </defaultProxy>
    </system.net>
    

    MTM did not have a system.net setting and the whole section was added immediately following the closing xml tag </appSettings>.

    Gorgsenegger
    • 7,356
    • 4
    • 51
    • 89
    Larry Aultman
    • 301
    • 2
    • 10
    6

    Download and install Fiddler

    Open Fiddler and go to Rule menu to tick Automatically authenticate

    Now open visual studio and click on sign-in button.

    Enter your email and password.

    Hopefully it will work

    Sulman Saeed
    • 61
    • 1
    • 2
    3

    Using IDE configuration:

    1. Open Visual Studio 2012, click on Tools from the file menu bar and then click Options,

    2. From the Options window, expand the Source Control option, click on Plug-in Selection and make sure that the Current source control plug-in is set to Visual Studio Team Foundation Server.

    3. Next, click on the Visual Studio Team Foundation Server option under Source Control and perform the following steps: Check Use proxy server for file downloads. Enter the host name of your preferred Team Foundation Server 2010 Proxy server. Set the port to 443. Check Use SSL encryption (https) to connect.

    4. Click the OK button.

    Using exe.config:

    Modify the devenv.exe.config where IDE executable is like this:

    <system.net> 
      <defaultProxy>  
       <proxy proxyaddress=”http://proxy:3128”
         bypassonlocal=”True” autoDetect=”True” /> 
       <bypasslist> 
       <add address=”http://URL”/>  
      </bypasslist> 
     </defaultProxy> 
    

    Declare your proxy at proxyaddress and remember bypasslist urls and ip addresses will be excluded from proxy traffic.

    Then restart visual studio to update changes.

    bahrep
    • 29,961
    • 12
    • 103
    • 150
    Carlos Landeras
    • 11,025
    • 11
    • 56
    • 82
    • Thank you for the fast reply, Carlos. As I was executing your solution I found that my TFS server itself is not one a proxy. I am on a corporate web filter (it's between me and the server). I need some workaround so VS either uses supplied credentials or prompts me for them while accessing web based resources. Any suggestions? – gillytech Dec 05 '12 at 18:03
    • Yes, I tried to supply the information in this format: `proxyaddress="http://username:password@proxy:port"` which did not seem to have any effect. – gillytech Dec 05 '12 at 23:32
    3

    This helped in my case :

    1. close VS instance
    2. open Control Panel\User Accounts\Credential Manager
    3. Remove TFS related credentials from vault

    This is just a hack. You need to do it regulary ... :-(

    Best regards,

    Alexander

    3

    I was getting an "authenticationrequired" (407) error when clicking the [Sync] button (using the MS Git Provider), and this worked for me (VS 2013):

    ..\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config

      <system.net>
        <defaultProxy useDefaultCredentials="true" enabled="true">
          <proxy proxyaddress="http://username:password@proxyip:port" />
        </defaultProxy>
        <settings>
          <ipv6 enabled="false"/>
          <servicePointManager expect100Continue="false"/>
        </settings>
      </system.net>
    

    I think the magic for me was setting 'ipv6' to 'false' - not sure why (perhaps only IPv4 is supported in my case). I tried other ways as shown above, but I move the "settings" section AFTER "defaultProxy", and changed "ipv6", and it worked perfectly with my login added (every other way I tried in all other answers posted just failed for me).

    Edit: Just found another work around (without changing the config file). For some reason, if I disable the windows proxy (it's a URL to a PAC file in my case), try again (it will fail), and re-enable the proxy, it works. Seems to cache something internally that gets reset when I do this (at least in my case).

    James Wilkins
    • 6,836
    • 3
    • 48
    • 73
    2

    I was trying to connect Visual Studio 2013 to Visual Studio Team Services, and am behind a corporate proxy. I made VS use the default proxy settings (as specified in IE's connection settings) by adding:

    <system.net> <defaultProxy useDefaultCredentials="true" enabled="true"> <proxy usesystemdefault="True" /> </defaultProxy> <settings> <ipv6 enabled="true"/> </settings> </system.net>

    to ..\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config (running notepad as admin and opening the file from within there)

    Esther Fan - MSFT
    • 8,276
    • 4
    • 27
    • 25
    0

    I faced the same error with my Visual Studio Team Services account (formerly Visual Studio Online, Team Foundation Service).

    I simply entered the credentials using the VS 2013 "Connect to Team Foundation Server" Window, and then connected it to the Visual Studio Team Services Team Project. It worked this way.

    Esther Fan - MSFT
    • 8,276
    • 4
    • 27
    • 25
    Tarun
    • 2,808
    • 3
    • 22
    • 21
    0

    My case is when using two factor auth, outlook account and VS12.

    I found out I have to

    • open IE (my corporate default browser)
    • log in to visual studio online account (including two factor auth)
    • connect again in VS12 (do the auth again for some reason)
    Boris Callens
    • 90,659
    • 85
    • 207
    • 305
    0

    I was having the same problem, and none of the posted solutions worked. For me the solution was:

    • Open Internet Explorer > Tools > Internet Options
    • Click Connections > LAN settings
    • Untick 'automatically detect settings' and 'use automatic configuration script'

    This prevented the proxy being used, and I could then authenticate without problem.

    Mashton
    • 6,037
    • 2
    • 25
    • 35
    0

    I got this error when running dotnet publish while connected to the company VPN. Once I disconnected from the VPN, it worked.

    Cosmin
    • 2,365
    • 2
    • 23
    • 29