Visual Studio Error: (407: Proxy Authentication Required) - visual-studio

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:
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

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:
Open TOOLS>Extensions & Updates
Click on Updates... in the left-hand menu
There will be a failure notice on screen and a link to enter your credentials. Click it and enter them.
Close the Extension manager.
Click TEAM>Connect to TFS server...
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.

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.

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>

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>.

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

Using IDE configuration:
Open Visual Studio 2012, click on Tools from the file menu bar and then click Options,
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.
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.
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.

This helped in my case :
close VS instance
open Control Panel\User Accounts\Credential Manager
Remove TFS related credentials from vault
This is just a hack. You need to do it regulary ... :-(
Best regards,
Alexander

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).

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)

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)

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.

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.

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

Related

VS2019 Online Extensions list is empty. Then full. Then empty again

A colleague is having a bizarre problem with Visual Studio. I am literally watching this happen live while we're on a Teams call and she shared her screen.
In Visual Studio She goes to
Extensions >> Manage Extensions >> Online
And sees this error message
A connection to the server could not be established because the
following error(s) occurred:
An error occurred while sending the request. The underlying
connection was closed. An unexpected error occurred on a send.
Unable to read data from the transport connection. An existing
connection was forcibly closed by the remote host.
Here is the weirdest part. She will click around elsewhere in Visual Studio without making any changes (e.g. we were looking at things like Tools >> Options >> Accounts but changed nothing) and come back and suddenly all the extensions will appear.
Then, she'll go away and come back to it and they'll disappear again with the same error message
We cannot seem to find any rhyme-or-reason as to why this would happen. We tried disabling all firewalls she has (Windows Defender) but it made no difference.
Any idea where I should look?
(I did find this question but it does not seem to apply
vs2017 cannot browse online extensions)
Try these:
1) close VS, delete the folder C:\Users\Administrator\AppData\Local\Microsoft\VisualStudio\16.0_xxx, then restart VS to test again.
2) not sure if this is a problem of DNS. Please check this document. Or you could try to fix your DNS.
3) close VS, open C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe.config and then add these:
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="true" bypassonlocal="true" />
</defaultProxy>
<settings>
<ipv6 enabled="true"/>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
Then, save it, restart VS to test again.
4) update VS2019 if there is any new release versin.
I found the answer on the Visual Studio forum:
I found the issue, it was because the "The Program worked in earlier versions of Windows but won't install or run now" option was set. This check box is in Program Compatibility Troubleshooter of devenv.exe in \Microsoft Visual Studio\2019\Professional\Common7\IDE folder.

Visual Studio 2019: "This site can’t provide a secure connection" on localhost

I've installed Visual Studio 2019 and uninstalled Visual Studio 2017.
Now if I start an ASP.NET (Core) site with https, it always say on Chrome:
This site can’t provide a secure connection
or on Edge
Can’t connect securely to this page
Screenshots:
Chrome:
Edge:
The URLs are correct. This also the same http://localhost:56784/ (it redirects to https)
Tried
What I've tried:
Updated Visual Studio 2019
Create a new ASP.NET Core 2 website
Tested with a ASP.NET site (non core)
Remove IIS certificates with MMC
Checking/changing the IIS settings in Visual Studio 2019 (project properties with context menu and project properties with F4)
Searching on Stackoverflow & Google ;)
Repair Visual Studio 2019
Issue
I think the issue is introduced by:
Installing Visual Studio 2019 and/or,
Uninstalling Visual Studio 2017 and/or,
Updating Windows 10 (current Version: 10.0.18362 Build 18362)
The underlining issue looks like a wrong/old/not supported TLS version?
Question
What can I do to diagnose/fix the problem?
Just as it did not work for #Nosnetrom - repairing IIS 10.0 Express did not work for me either. As #Julian mentioned my problem was caused by uninstalling VS 2017 as well.
This is what did not work for me:
uninstalling / re-installing VS 2019
installing VS 2017
uninstalling / re-installing / repairing IIS 10.0 Express
This is what worked for me:
after reading this advice - I realized that I was using port 51542 instead of a port in the range of 44300 through 44399
then I updated the applicationhost.config file according to this advice. The location of said file on my Windows 10 machine is: C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer\applicationhost.config. I had to open that file in Notepad ran as an administrator otherwise I could not save these changes:
then in Visual Studio I created a new virtual directory
that seemed to have done the trick for me - when I ran the application it worked
Repair of IIS Express fixed my problem:
For those who all the above methods didn't worked:
open a command prompt and then run:
dotnet dev-certs https --clean
and then:
dotnet dev-certs https --trust
None of the above solutions worked for me, Following steps worked for me.
Go to chrome or edge browser and type chrome://net-internals/#hsts
search for localhost in query domain, you will find lists of domain including localhost. Now delete the domain
Delete the domain by typing localhost
Just follow below steps:
Close Visual Studio
Delete .vs folder
Restart Visual Studio
Build and Run the Application
As per my understanding, .vs folder keeps the old settings inside the applicationhost.config file. So better to delete all cached settings and start with fresh.
None of this worked for me. What did work (and it's not as drastic as the other answers)...
Go into web project and set Start URL and Project URL to this: https://localhost:44365/
Save (but don't run the Project).
Edit .vs/[ProjectName]/config/applicationhost.config and change the bindings for the web project to this:
<binding protocol="https" bindingInformation="*:44365:localhost" />
<binding protocol="http" bindingInformation="*:53269:localhost" />
Reopen Visual Studio and when I started the website it worked.
I solved this problem as follows;
run the web project in debug mode on Visual studio 2019.
if it's on chrome you should do this ;
In my case use SSL check box was gone in debug section of project properties. everything was fixed by checking again
Right click on the project, select Properties, 'Debug', check the checkbox "Enable SSL", that's it, worked with me by doing this
If you 'are using services.AddHttpsRedirection like
services.AddHttpsRedirection(options =>
{
options.RedirectStatusCode = (int)HttpStatusCode.TemporaryRedirect;
options.HttpsPort = Configuration.GetValue<int?>("https_port", null);
});
Make sure HttpsPort is null or a valid port in appsettings.json or appsettings.Development.json file.
Clear your browser history and cookie

Visual Studio 2015 - Can't sign in, Use NuGet, etc. behind corporate proxy

I'm behind a corporate proxy server that requires authentication. Using Visual Studio 2015, I am not able to sign in, use NuGet, browse Extensions, etc. - all things that would require going through the proxy to access the Internet. This isn't a problem in previous versions of Visual Studio.
If I run Fiddler, which acts as an intermediary proxy, and will authenticate to the corporate proxy, then everything works. Or, if I get my laptop on public Internet (not behind the corporate proxy), everything works.
I've tried modifying C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config as suggested here. I've tried
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://<yourproxy:port#>"/>
</defaultProxy>
and
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="true"/>
</defaultProxy>
...but to no avail. Anyone else run into this issue?
UPDATE: As Dimitri stated below, NuGet now works correctly. The only thing that still doesn't work is the sign-in screen and the "Featured Videos" feed on the Start page. I've been in contact with our Microsoft account rep, and I'm sending a memory dump to Microsoft for them to troubleshoot further.
UPDATE: NuGet stopped working again. We've determined that the reason that Fiddler makes it work is because Fiddler forces TLS 1.0 connections. The main issue is that our corporate proxy, BlueCoat, is not allowing TLS 1.2 connections, and Visual Studio must not gracefully fallback to TLS 1.1 or 1.0 like IE/Chrome does. Armed with this info, I'm going to our network/security team to attempt to get somewhere.
.Net 4.6 (and Visual Studio 2015) has a different default for System.Net.ServicePointManager.SecurityProtocol than prior versions of the framework. The default now includes TLS 1.2 and TLS 1.1, in addition to TLS 1.0. That's why this was never an issue in earlier versions of Visual Studio.
In our case, the issue came down to our corporate BlueCoat proxy not supporting the TLS 1.2 ECDHE-ECDSA ciphers. The long-term solution is to update BlueCoat to a version that supports this new cipher. But for the short term, we were able to specify the order that Windows attempts to use different cipher suites, so it uses a cipher that BlueCoat understands.
Open Local Group Policy Editor (gpedit.msc)
Expand Computer Configuration -> Administrative Templates -> Network -> SSL Configuration Settings.
Open the SSL Cipher Suite Order setting.
Set the setting to Enabled, and then set the SSL Cipher Suites order to:
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P384,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P384,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA,TLS_RSA_WITH_RC4_128_MD5,SSL_CK_RC4_128_WITH_MD5
(make sure there are no spaces in the list after you copy-and-paste it)
Hit OK, and then Restart your computer.
The only change from default is to move TLS_ECDHE_RSA_WITH_AES_CBC_SHA_P256 to the beginning so that higher strength ECDSA ciphers are not negotiated first for TLS 1.2. If you're having a similar problem, you may need to work with your network/security team to determine what ciphers you need to give preference to.
Use this address in NUGET setting
http://packages.nuget.org/v1/FeedService.svc/
this address is HTTP protrocol and work fine.
using fiddler4 and let it act as a proxy (and decrypt the https traffic) works around the issue
Using Fiddler to sniff Visual Studio 2013 requests (proxy firewall)
Many users(including me) have same issue:
https://social.msdn.microsoft.com/Forums/en-US/06e580a4-fede-43cf-b285-3d3d66fb1b9a/cant-sign-into-vs-2015?forum=vssetup
Update:
With new version of nuget => nuget connection is now working.
On Visual 2019 I ran into a similar problem.
I saw the following error output by NuGet package manager in Visual Studio:
https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host.
I saw the same error when executing dotnet restore --interactive from the command prompt.
This was oddly fixed by doing the following, which amounted to no saved changes for the SSL Cipher Suite Order (I guess it got corrupted somehow). Note, mine was disabled, and all I did was enable then re-disable without doing any changes.
Open the Local Group Policy Editor via Run -> gpedit.msc
Open SSL Cipher Suite Order from Administrative Templates -> Network -> SSL Configuration Settings
Select Enabled then press OK
Select Disabled then press OK
Restart computer

Cannot search for online exensions because an error occured while trying to contact the server

My problem is this error
"Cannot search for online exensions because an error occured while trying to contact the server"
in extension manager > online extensions.
I know 2 solutions from this thread Cannot connect to any online resource:
Adding **servicePointManager expect100Continue="false"**
I tried this. But doesnt work.
2.Add:-
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy proxyaddress="http://your.proxyserver.ip:port"/>
</defaultProxy>
I want to implement this but I dont know what how to fill <http://your.proxyserver.ip:port>
I did a proxy check and i got this
"
The proxy host has ip address 182.237.151.96
The proxy server has announced itself as 1.1 fivenet5.netsolutioninc.com:8102 (squid/2.7.STABLE9)
The proxy informs us that the client host ip address was 182.237.151.96
"
Can someone help pls. I m a rookie in this.
Thank you for reading this
Ok
For your question:
- I don't know where did you get the proxy information that you provided, but if it's right, you should put http://fivenet5.netsolutioninc.com:8102 as you proxy.
I was with the same problem as you and setting up servicePointManager expect100Continue="false" worked for me.
For what I think is your problem reading you comments:
- After install AnhkSVN if you have Visual Studio 2010 or 2012, you must set it as the source control manager.
Inside Visual Studio, go to Tools -> Options -> Source Control.
From there, select AnkhSVN in current source control plug-in (normally its None or Visual Studio Team Foundation Server).
Restart Visual Studio and everything should work.
Hope it helps

IIS Express Web Server - (Every) Port is in Use?

Today I installed VS2010 SP1 Beta, and IIS 7 Express, as I currently have IIS5 on my local development machine and thought I'd try IIS Express out.
I have gone into the properties window for my Web Application, checked the 'Use IIS Express' checkbox, created the Virtual Directory when it has prompted me, but then get the message "Unable to launch the IIS Express Web Server. Port x is in use".
I have tried changing the port number from the default value that was in there, to numerous other port numbers, but whatever value is there, I am always getting this message, and am therefore unable to use the IIS Express Web Server.
Does anyone know what the problem might be, and how to get around it?
If you are using ESET NOD32 Anti Virus, you need to change the setting of "Web access protection" => HTTP, HTTPS => Web browsers => red cross the check box of your devnev.exe (This is three state checkboxs, click the check box until red cross appeared)
I have just installed VS 2010 SP1, using the above setting to tell NOD32 to leave 'IIS Express' alone.
Reference: http://weblogs.asp.net/anasghanem/archive/2009/02/01/nod32-antivirus-is-blocking-visual-studio-built-in-development-server.aspx
What version OS are you using?
Are you able to start IIS Express from command line? Could you try the following and post the error message you are seeing.
Remove IISExpress directory located under 'My documents' folder
Go to IIS Express installation folder '%programfiles%\IIS Express' (on 64-bit machine '%programfiles(x86)\IIS Express') and try to start iisexpress.exe from command line (without passing any arguments)
I had a similar problem. It seems that if IIS Express is already running a particular site and then you try to run a project that uses that site through Visual Studio it isn't able to attach the debugger. The solution was to close any running instances of IIS Express and WebMatrix and then try running the site through Visual Studio (F5).
I recommend installing WebMatrix as it's the simplest way of managing the sites and port numbers that you are using.
I have the same problem in the visual studio 2012.
I am creating a sharepoint app for the SharePoint 2013 and it happened after some days means it was working before then I got the error:
" Unable to Launch IIS web Server " "port 62308 in use.
To fix this I just went to the settings of the web project by right clicking on the project node in in right panel under the project solution tab. Change the port number and configure the virtual directory and it worked for me.
Hope it work for anyone else in case he/she has any problem.
1- Close Visual Studio.
2- Delete IIS Express folder in Documents or edit applicationhost.config:
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
3- Delete solution file.
4- Start Visual Studio and use open website.
5- Choose your website folder.
If any body still facing the same issue ... even after trying all the above steps
try the following simple steps...
1) close all other applications
2) Download TcpView application from
http://technet.microsoft.com/en-gb/sysinternals/bb897437.aspx
3) run the application, check the localport column and see who is using that specific port
and end that task
That will solve your problem ... :)
go to solution explorer, right click on the present Application then go to properties, now click on web scroll the mouse and change the port no. from project localhost:1257
NOW RUN IT...

Resources