TF31002 Can't connect to TFS online from VS 2012 - visual-studio

Problem
I'm using VisualStudio 2012 Ultimate v11.0.50727.1 Update 4 and VisualStudio 2013 Ultimate v12.0.21005 EL and I'm able to connect to TFS through any browser. But suddenly I can't connect to TFS at xxxxx.VisualStudio.com from within VisualStudio anymore. Yesterday I easily did a Check-In at work with the same account. but I can't connect to TFS at home.
This is the URL I'm using: (I've tried changing it a bit like adding /tfs or /DefaultCollection)
I'm stuck with this, I've tried different ways but none have worked so far and it's still giving me these errors: TF31002, TF300324 and TF205020
TF31002 (this error happens when trying to Add a new server)
TF205020: Could not connect to server ‘https://xxxxxx.visualstudio.com/defaultcollection’. This server was used in your last session, but it might be offline or unreachable. Confirm that the server is available on the network. To attempt to connect again, or to a different server, click ‘Connect To Team Foundation Server’ in Team Explorer or the Team menu.
TF400324: Team Foundation services are not available from server https://xxxxxx.visualstudio.com/defaultcollection.
Technical information (for administrator):
The underlying connection was closed: An unexpected error occurred on a send.
(The last 2 errors happen when VisualStudio is trying to login to tfs)
I've tried these:
Go to VisualStudio.com and Sign out from all browsers
Delete Cookies and Caches of IE10 (and test when IE has signed in to visualstudio.com or signed out of it)
Go to Regedit and set the DWORD to 0 in HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances
Browse to %LocalAppData%\Microsoft\Team Foundation\4.0\Cache and delete everything
Delete all credentials from Windows Credential Manager (and remove Link Online ID)
Installed VS2013
Installed Team Explorer 2013
Installed VS2012 Update 4
Installed a fresh copy of Windows 8
What I want.
After some long and desperate time of trying to connect to TFS online, Now I'm just looking for a way to Check-in my changes. (doing it by hand is not an option because there's a large number of changes and I can't even know which files are changed since last check-in)

I just saw this link and it totally worked for me after nothing else would: http://www.cnblogs.com/CuteNet/p/3556276.html
regedit:
Close all instances of Visual Studio 2013
Delete this folder in the registry (just “TokenStorage” – nothing else):
HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage

I had similar issue where I couldn't connect (TF31002) to TFS 2010 using VS 2010, 2012 and 2013 on my laptop but can connect from web and other servers just fine.
I tried almost all suggestions given by various sources online but had no luck.
I was getting ready to reimage tha laptop but as one last try I started comparing config's between another virtual machine (where the connection was successful) to my laptop. I found that in my laptop I have additional defaultProxy settings in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config’
<system.net>
<defaultProxy>
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://XXX.X.X.X:XXXX" usesystemdefault="false"/>
</defaultProxy>
</system.net>
After deleting the above node completely I was able to connect to TFS 2010 successfully.
Hope this helps.

I've found a way to check-in all changes of the home computer at work computer.
Copy the local TFS folder from home computer (including the hidden $tf subfolder) to work computer.
Install Team Foundation Sidekicks for 2012
Search for the home computer name
Click on Update Workspace Computer Name
Go to Source Control Explorer and open Workspaces...
Check Show remote workspaces checkbox (if the home workspace is not shown)
Edit the home workspace
Remove current mapping
Map $/ to the local folder (which has $tf)
When click on Advanced It should look like this:
Switch to the new Workspace and done!
It seems to me that private workspace is what causing the problem, and I will try to change it to public after I checked in.
Edit
I've found another workaround which requires no workspace hacks. (This method is originally designed for recovering from wrong check-ins)
In Source Control Explorer select root (collection, not project)
click Compare folders
in source version section choose the latest safe version
in target path section browse to the not-checked-in folder
make sure both paths end with same name (e.g. $/MyProj and E:\FromHome\TFS\MyProj)
(set any additional settings...) and click OK
DoubleClick on files with different value of Yes and write down the names of those file that should be loaded from local folder (right part of screen probably shows local)
Open those files from Solution Explorer and overwrite them with local files

I faced the same issue few days back
1. Disable your firewall(not recommended)
2. Run VS 2013 in admin mode.
3. Disable antivirus or add TFS in whitelist.
4. Select connect to TFS and create a new project in another directory (Local copy)
5. Check the directory for access(Read only by default change the permissions)
6. try to check in now.
After changing the permissions to the local directory i was able to check in my changes.

I was having the same issues using Visual Studio 2013 Update 2 and for me the problem was Anti-Virus software (Kaspersky Endpoint Security 8). See this link: http://blogs.msdn.com/b/dstfs/archive/2014/07/24/can-t-connect-to-visual-studio-online-from-any-version-of-in-vs-quot-the-underlying-connection-was-closed-an-unexpected-error-occurred-on-a-send-quot.aspx

Check your URL first!
I had a problem with such URL:
https://domain-name.com
Turns out that symbol "-" where replaced with some special char ­. But Visual Studio 2012(2013) did not indicate that anyhow. Apparently it was not able to find such domain. As result same issue TF31002 and a day spent in research.

I was having a similar problem with Visual Studio Premium 2013 connecting to our project from inside VS. It kept returning TF31002, but I could access it with a browser.
From the browser I went to Home->Activities->Open New instance of Visual Studio and my tfs project loaded right into the Team Explorer frame.
Hope that helps.

I had the same issue when I wanted to connect to the TFS with Visual Studio. This solved my problem:
I used a VPN connection to the server
I used the ip address instead of the link given by the TFS (http://"ip address":8080/tfs instead of http://"link":8080/tfs)

Related

Is it possible to open a project with Visual Studio from different machines?

Earlier I asked a question, which has now been deleted. It was asked me of to come up with some different wording to my question. I'm sorry, but in this case I don't know how better to ask it then I have. Here's what I said:
At work I've got a desktop with Windows 10 on it. Been working there
for 3 years. We using TFS 2015 with TFVC. Recently I was given a
laptop, but without enough disk space, so what I have done is on the
laptop I mapped a drive to the second drive on my desktop, where I
keep all of the Visual Studio projects I work on, that are in TFS. I
had hoped I could just open the project on the mapped drive from the
laptop to the D: drive on the desktop. But VS complained to me. So, is
it not possible to open the same project, on only 1 machine, but being
accessed both on the machine and by a mapped drive from another
machine?
Perhaps it would be best if I illustrated. On my desktop I have a project in my D: drive, so it's located in D:\Src\LRAT. Its in TFS 2015 and we're using TFVC on-premise.
On my laptop I've mapped the drive from the desktop, using D: on the laptop, as D was available. So, I get into VS 2017 on the laptop and try to open the project in D:\Src\LRAT on my laptop. However, trying to do that results in a warning message issued from Visual Studio (the complaint I mentioned earlier) which says:
Team Foundation Server Version Control
The solution you are opening is bound to source control on the
following Team Foundation Server:
http://ourserver:8080/tfs/defaultcollection. Would you like to contact
this server to try and enable source control integration?
This confuses me a lot! I know that its in source control. Why is it asking me if I want it in source control? I want to be able to open it and use TFS/TFVC from my laptop against the same files and folders that are on my desktop. The dialog box that warning pops up in has 3 buttons, Yes No and Help. Clicking Help sends me to a very unhelpful link about Git and VSTS. I don't know what will happen if I click the Yes button, because that project on my desktop is already in source control, so I just click No because I don't know what else to do.
So, this leads to ask is it the case that in some way I don't yet understand opening a project created in VS 2017 and saved to TFS under TFVC on my desktop is different than opening that same project from my laptop connected to the D: drive on my desktop?
The solution you are opening is bound to source control on the
following Team Foundation Server:
http://ourserver:8080/tfs/defaultcollection. Would you like to contact
this server to try and enable source control integration?`
This kind of pop-up info, usually indicate there are some mapping issue related. Please double check your workspace mapping first.
Besides you could also try to connect your project in Team Explorer -Visual Studio follow below steps:
1 View->'Team Explorer'
2 'Manage Connections' (green plug)
3 'Manage Connections' (drop down) -> 'Connect to Team Project'
4 List of projects shows up from your account.
5 Select Project and Connect
More details take a look at this similar issue-- Opening an existing VS2015 solution bound to TFS hangs VS2017RC

TFS Error - Unexpected End of File

When I open Visual Studio and attempt to connect to TFS, I get the following error message:
Error
Unexpected end of file.
I've found a handful of places online (like here and here) where people have run into similar situations but clearing the Team Foundation cache as recommended doesn't solve the issue.
I even completely uninstalled Visual Studio Enterprise 2015 and installed Visual Studio Enterprise 2017 and still get the same error.
I recently created a new TFS instance on another server for testing out some automated build features without messing with our current setup and can connect to the new TFS instance just fine.
What would cause this error?
First you could use another machine with VS installed to connect the same TFS under your account. This will narrow down if the issue only occurs on your local machine or not.
You could try to clear both TFS and VS cache issue.(You may not uninstalled the previous VS clearly).
For TFS cache:
close all instances of Visual Studio on the client machine,
manually delete the corresponding Tfs client cache folder, and then
start Visual Studio
The corresponding Tfs folders to manually delete are as follows:
Tfs 2017: "%localappdata%\Microsoft\Team Foundation\7.0\Cache\"
Tfs 2015: "%localappdata%\Microsoft\Team Foundation\6.0\Cache\"
For VS cache:
Delete the contents from the following folders
C:\Users\<<Your Alias>>\AppData\Local\Microsoft\VisualStudio
C:\Users\<<Your Alias>>\AppData\Local\Microsoft\VSCommon
Moreover, also give a try with removing the tfs related credentials from Credential Manager, close all Visual Studio instances, deleting %LOCALAPPDATA%\.IdentityService, use another user account connect to the TFS server.
Update: Op ended up doing an OS reload and haven't had any issues since.
I ended up doing a full OS reload
It was likely overkill as I'm convinced there was a cached file somewhere I couldn't locate that was holding those settings but I didn't have the extra time to fiddle with it and I needed to move to Windows 10 at some point anyway.
I'd venture to guess #PatrickLu-MSFT's answer will work for most people but for whatever reason it didn't for me.
In my case I closed Visual Studio 2017, went to the solution's directory and deleted the .vssscc file.
The file was then regenerated and the problem was solved.

TF400324: Team Foundation services are not available from server <Server/CollectionName> in Visual Studio 2012

When I open my existing solution in Visual Studio 2012 professional, I got the above error. This used to work but something messed up after the computer is rebuilt.
I have installed Visual Studio 2015 Community and can connect to the same
collection correctly.
I also tried to use a browser to connect to the same collection. It works fine also.
Cleaning all files in AppData\Local\Microsoft\Team Foundation\4.0\Cache does not work.
It should not be a firewall or proxy issue since Visual Studio 2015 works.
Anyone knows what is wrong with Visual Studio 2012 and how to fix it?
Edit:
This error can happen with later versions of TFS:
Team Foundation Error
TF400324: Team Foundation services are not available from server TFSServer\DefaultCollection.
Technical information (for administrator):
Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.xxx.xxx.xxx:443
According to this blog the solution is (and Yes it worked for me)
Close all instances of Visual Studio
Open the Task Manager and check if any TFS Services are running. Select each of them and click on End Process Tree (in my case I did not find any of them to End)
Browse to the folder %LocalAppData%\Microsoft\Team Foundation\
and then select the folder with your TFS version and go inside the Cache folder.
for example, in my machine the path was %LocalAppData%\Microsoft\Team Foundation\7.0\Cache and it should be the same on your machine with the difference of the TFS version folder name.
Delete everything in that Cache folder.
Start Visual Studio and build the project
I got this error in TFS2017. For me the problem was a Self-Signed Certificate.
Open the TFS URL in IE and you will see a Red Address Bar:
Click the "Certificate Error" in the address bar:
Then select "View Certificates":
If clicking "View Certificates" doesn't work, right click on page > Properties > Certificates.
If the Install Certificate button is hidden to make it visible you will have to Open Internet Explorer Options > Security > Sites > type the TFS server URL > Tick Require server verification > click Add. (If the dialog is disabled see the guide Trusted Sites Dialog is Disabled at the end of this answer).
Once you have the install certificate button available, select “Install Certificate”.
This will launch the Certificate Import Wizard. Make sure to Choose the option “Place all certificates in the following store” and select browse.
Select Trusted Root Certification Authorities and click Ok.
Click Finish on Completing the Certificate Import Wizard:
Click yes on the security warning to install the certificate.
=================================================
Trusted Sites Dialog is Disabled
You can check to see if the site is Trusted, on Windows 7 the path is:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey
The key should contain several string values with a name indicating the URL and numeric data indicating the zone, one of the following by default.
0 = My Computer
1 = Local Intranet Zone
2 = Trusted sites Zone
3 = Internet Zone
4 = Restricted Sites Zone
If the TFS site is not listed in the registry then add it manually. Restart Visual Studio and try to connect to the TFS server again from Visual Studio. Once you can connect you can also remove the TFS server from the Connection List. I suggest removing it and adding the FQDN url which will most likely already have a Trusted Site rule.
Edit
Hit this again. This time it was caused by a problem with a network card that was replaced on the weekend by our telecommunications provider.
This issue is happening when server is not responding, In my case server hosting TFS was down, we restarted and get connected.
Try clear both local TFS cache and Visual Studio Cache
clear visual studio cache under
%APPDATA%\Microsoft\VisualStudio
clear TFS cache under
%LocalAppData%\Microsoft\Team Foundation
...better late than never...
I just had a user run into same error TF400324 connecting VS2012 to TFS2015 (hosted in a virtual private cloud). TFS Web Access worked fine for her, but Visual Studio 2012 UI was stuck in offline connection.
FIX: She managed to get VS connected again after clicking Team Explorer > Connect | {TeamProject}, Then select desired Team Project below the TFS Server connection (see screenshot attached).
NOTES:
I suspect clearing client-side TFS cache might also fix, but all VS instances would need to be closed then "Connect to Team Project Connection" re-established. Just disconnecting and reconnecting VS to TFS did not clear the "offline" state.
Error she saw was in VS output window:
This solution is offline. [Team Foundation Server: {//TFS Collection URL}]
The solution was offline during its previous session and will remain offline.
TF400324: Team Foundation services are not available from server .
Technical information (for administrator):
Page not found.
NOTE: I recently moved TFS to different domain requiring SSH connection and localhost port mapping. I have users going offline much more frequently due to different proxy routing depending on whether they are at work or connected more directly to the Internet.
For me the fix was simply running Visual Studio (2010) as an administrator.
In my case, my company VPN my Host machine was connected to was preventing me to access the tfs on a VirtualBox VM, returning this exact error message.
We solved it by adding a specific exclusion to ESET / Kaspersky AntiVirus for the devenv.exe
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
Its been working great ever since.
I get basic idea from this link
Soluton for me was to run the standalone TFS installation. This is for 2017, but worked to fix my VS2019.
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=TeamExplorer&rel=15
Bit of background...
I'd been having this issue since 2017. Tried all the usual suggestions on here, cache clearing, config file editing etc. but would always have to come off my organisation's network to check code in, as it was proxy related. TFS was trying to connect to a proxy server ip that had been decommissioned, no one from the service desk could work out why. Couldn't find any reference to this old ip in any config files.
Installed VS2019 hoping it would solve the issue but it persisted. Eventually I thought of trying to uninstall it as a component and re-installing it. Couldn't find a way to do that but in my search I found the standalone installer for Team Explorer, albeit for VS2017.
After installing, I ran this, opened up Manage Connections in the Team Explorer connections page and did what I needed to connect to the repository from there. Worked first time. Closed Team Explorer 2017, opened my VS2019, and everything seemed fine in there as well.
Amazed my problem is finally solved!
This error is usually related to the TFS cache. Before you clear the cache folder, please make sure you have closed all instances of Visual Studio and also try to open Task Manager and check if any TFS Services are running. Select each of them and click on End Process Tree.
And also clear the server cache Server cache, the path like C:\ProgramData\Microsoft\Team Foundation\Web Access
Then restart Visual Studio and run as Administrator Mode.
More details you can refer this blog (archived version at the bottom) and also could try the better fix.
Note: Make sure you are working on a different workspace rather then VS2015's.
For me it was the windows firewall causing this problem : TF400324 The underlying connection was closed.

team server foundation 2010 is only working in offline mode

In my company, we are using Team Server Foundation 2010.
Last week when I was checking out some ssrs (sql server reporting services 2010) files, I obtained the correct files from TFS. I could see that the files were still connected to TFS.
However, I think there was a time last week where there was a message saying that I was working offline.
Now when I obtained the most current code from TFS, I do get the correct code. However I do not see that the code is connected to TFS any longer. Basically when using Source Control Explorer, I do not see that this code is linked to TFS
Thus I would like to know how to get my code back to accessed in TFS 2010?
Do you see the same problem with all files in TFS or only specific set of files?
Do you see this problem in only one workspace or in all workspaces on a single machine? Or does it affect all users?
What does it mean that files are not linked to TFS, can you post a screenshot?
TFS 2010 was quite weak story for offline and it worked only for solutions (as visible in Solution Explorer). Source Control Explorer always required connection to TFS
I'm also confuse about “files are not linked to TFS”you describle ,can you post a screenshot.
Simply offline mode means TFS 2010 goes offline (disconnect the connectivity properly between your local machine and TFS 2010 server) while your solution is already open though VS 2010.If you checkout files while you are in offline mode, then TFS 2010 source controls system doesn’t record or track any changes you made. But when you reconnect TFS server, the server will get you changes in pengding changes, then you can check in manually.
To get your solution back online to TFS you can try this solution:right-click on the solution name right at the top of the Solution Explorer and select the Go Online option.
More detail: How do I get my solution in Visual Studio back online in TFS?
You need to use the "go online" command to re-sync:
Cannot see go online option in tfs
Note: TFS 2010 is no longer supported and you should upgrade soonest

"Process with an Id of #### is not running" in Visual Studio

I am trying to run any program on visual studio 2013 update 3 and I get the following alert box:
Process with an Id of #### is not running.
Every time there is different ID number showing.
and in the error windows, I get this error message:
The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.
Sometimes it runs and in the browser I get the following message:
The webpage is not available.
Why is this occurring and how can I resolve it?
The following steps fix the problem for me:
Close Visual Studio
Navigate to the folder where your solution files are stored and delete the hidden .vs folder.
Restart Visual Studio
Hit F5 and IIS Express should load as normal, allowing you to debug.
Note: Based on my experience and others in the comments, this problem seems to be caused by moving a project between workstations, environments, or versions of Visual Studio. There must be some environment specific information contained in the .vs folder.
Open Visual Studio as an administrator
Right-click your project and click on 'Unload Project'
Again, right-click your project and click on 'Edit PROJECT_NAME.csproj'
Find the code below and delete it:
<DevelopmentServerPort>63366</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:63366/</IISUrl>
Save and close the file .csproj
Right-click your project and reload it
First Error
For the first error:
Process with an ID #### is not running.
The following steps worked for me:
Close all instances of Visual Studio.
Rename the IISExpress folder (in my PC is in C:\Users\jmelosegui\Documents).
Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1.
Start Visual Studio in administrator mode. (In Windows, right click the executable file and select Run as administrator).
Second Error
The second error:
The webpage is not available
What caused this error:
I deleted IIS Express Development Certificate while playing with the SSL.
The following steps worked for me:
Go to Control Panel.
Select Add/Remove Programs.
Locate IIS 8.0 Express.
Right click on it then click Repair.
Your certificate should be back!
With respect to the first error:
Process with an ID #### is not running
This situation will sometimes occur when IIS Express fails to bind to a port. A likely reason for that is that some other process has already bound to that port. Visual Studio will launch the IISExpress.exe process (which will fail to bind to the port and exit again) and then attach to the now-terminated process, resulting in the above error.
To check, note the port number in your project settings (e.g. 12116) and then try:
netstat -ano | find "12116"
If another process has the port open, this will give its PID. You can then choose to kill the offending process or reallocate your own port number.
If you are using a 64-bit machine
Then the problem maybe due to Visual Studio use of 32-bit IIS-Express.
Solution: In Visual Studio, go to Tools menu > Options > Projects and Solutions > Web Projects > Enable the option "Use the 64 bit version of IIS Express" and click ok
I had the same problem. Just restarting Visual Studio worked for me.
My fix was simple, I was missing prerequisites. I needed to install .NET Core SDK
Kilanny's answer is correct. Most machines in 2015 are 64bit, so there's a lot of chances that you just need to enable the 64bit option under the Tools main navigation link menu. No need to configure other files or hard code ports. Besides, port assignment should be dynamic. This fix applies to 2013 With Update 3 and Visual Studio 2015 Community Edition.
Check the images below for a mini tutorial:
(I'm just improving Kilanny's answer)
It looks like there are many solutions that work and some that don't...
My issue kept surfacing after a few test iterations.
Yes restarting the PC and/or VS would resolve the issue...but temporarily.
My solution was to undo a security change I had enabled a couple days
earlier to Controlled folder access under Ransomware protection.
I undid this change by:
(right click Start)
Setting->Update & Security->Windows Security->Virus & threat protection-> Virus & threat protection settings->Manage settings
Under Controlled folder access
Click->Manage Controlled folder access
(this is also the Ransomware protection screen)
Turn Controlled folder access off.
This was 100% the issue for me as I was able to run my test without restarting VS.
Another reason this can happen is for a .NET Core Web app if you upgrade the Microsoft.AspNetCore.Components.* NuGet package to a new version but don't install the new SDK,
In my case it was upgrading Microsoft.AspNetCore.Components.WebAssembly from 6.0.0 to 6.0.1 and didn't install .NET 6.0.1 SDK
go to Properties of the start up project, increment port number of the Project Url is probably the quickest way to get around this problem which I didn't read anyone mentioned yet.
And you don't need to restart VS as it can be a pain sometimes if you needed a few other instances needed to be running.
My solution to this on a new machine and fresh install of VS 2022 was to install the 3.1 framework. So check to make sure whatever framework the project is expecting is installed on your local machine.
I had a similar problem with Chrome. It appears that VS can't attach to the Chrome process for some reason.
Solution:
Close Chrome
With Chrome closed, start the web project and allow VS to open Chrome.
For me, none of the other solutions worked.
The things I tried:
Updating and patching everything associated with Visual Studio
Reinstalling Visual Studio
Reinstalling IIS Express
Several reboots
Adding the _WORKAROUND thing to the PATH
Renaming the IIS folder under documents to regenerate the IIS config
Manually editing the csproj file and removing the whole IIS settings section
Changing the IIS executable usage to 64bit in VS settings
Changing the port of IIS in the projects settings
After checking if the problem was persistent over different projects, it turned out that the problem only occurred in one specific projects. I figured that I had to delete all the user specific files in the solutions folder (such as bin, obj, *.suo, ...)
I just deleted the whole solution folder and reverted the files in git.
TLDR:
Try deleting user specific files/folders like bin, obj, *.suo, ...
Reboot your computer before trying any of these!
Some of these may be helpful. Doing the netstat trick
netstat -ano | find
helped me as another application was using my port, but didn't completely solve my problem. IIS Express still kept crashing. It wasn't until I rebooted my win 10 PC (first time in over a week), that my problem completely cleared up.
Head to the following directory
%userprofile%\documents\IISExpress\Config directory
Delete all files within that folder. Restart visual studio and works like a charm.
I had the same problem, and what needed to be done was setup IIS Express properly.
I right clicked on my project Properties => Web (tab) and on Servers:
Project URL was already pre-populated and I clicked the button "Create Virtual Directory".
I had just reinstalled (refreshed) windows and the IIS was not setup b/c it was new.
I came across the same problem and found that somehow the file 'applicationhost.config' (in ..\Documents\IISExpress\config) had a different localhost port number (in the 'sites' section) to the one specified in project\properties\web. Changed them to the same number and the problem went away
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
Restart VS.
Hit F5 and IIS Express should load as normal, allowing you to debug.
If this not working, then:
right click your solution and go to properties
Click left menu Web tag
Click checkbox "Override application root Url"
and run again your project.
For me this was the solution,
Close all running Visual studio instances
Open the solution folder and remove the .vs folder (hidden folder)
Open Run Command
Type iisreset and press Ok, and you may see a command prompt and
wait for it to complete and it will close automatically
Now Open visual studio and run your project, it should run.
So, nothing worked for me and this happened to happen to me when I got a new machine. Apparently it didn't have the older versions of .Net on it. Went into VS Installer and checked the box for .Net 5 Runtime (VS 2022). Working fine now on all .Net 5 Projects.
TL;DR: if you do have the right .NET Core (or .NET I guess) runtime installed, install any patch updates or reinstall the latest version if there aren't any.
Detail:
Similar to a couple of other answers where they just didn't have the right .NET core installed. I was trying to run a .NET Core 3.1 web app which had worked fine previously for months, and this suddenly started happening.
I did have 3.1 (runtimes 3.1.21 and 3.1.22) installed. However a new one (3.1.23) had been released 12 days earlier, and installing that fixed the problem.
I have no idea if this was because it's aware that there's a new patch and I didn't have it so it wouldn't run, or if there was just something wrong with my 3.1.22 installation. Worth trying installing latest patch, or reinstalling existing installations.
I encountered this while trying to run a project I'd run many times on a machine I'd used for the project many times. Cleaning up my IIS Express directory and my .vs directory didn't work, nor did setting environment variables. I even tried re-cloning my repository to a different folder, but no success.
By trying to run via command line, I found a more useful message:
dotnet run --project [startup project path]
I saw that the project was trying to run using .NET 6.0.5, but I only had .NET 6.0.4 installed. Installing the latest .NET 6.0.5 from the Microsoft website worked.
I also had the same problem, doing the above didn't work for me. What my error turned out to be was twofold.
I had Opera as my default browser and it couldn't attach to that.
I had multiple startup projects so it wouldn't let me switch to IE until I change the default startup project back to just the MVC shell.
I set that project specifically as the startup, then I switched it back to launching IE and it started debugging again.
What I did to make this go away:
Open C:\Users\gr_mext1\Documents\IISExpress\config\applicationhost.config and remove all <site> entries in <sites> do not remove <siteDefaults>!
In your project, go to Properties, Web and click "Create Virtual Directory".
Close and re-open visual studio, load your project and run
Fixed!
None of the listed solutions worked for me. Problem was some sort of conflicting state in local applicationhost.config file. Fix is easy, just delete one in your solution. For VS2015 it should be located in <path_to_your_solution>\Solution\.vs\config\. When you launch Debug, VS will recreate that file based on settings in your project file.
Deleting the hidden .vs folder didn't work for me since the port specified in my app was being used by another app. Doing the following worked for me:
Went to properties and then click the web tab.
Changed the port number in the Start Url and the Project URL.
Clicked Create Virtual Directory.
Save and Press F5.
cmd - regedit-HKEY_LOCAL_MACHINE-SYSTEM-CurrentControlSet-Services-HTTP-START=3
Computer restarted.
worked for me!
Tried most of the things here to no avail, but finally found a fix for my machine, so thought I'd share it:
Following previous advice in another question, I had used netsh to add :: to iplisten. It turns out undoing that was my solution, by simply replacing add in their advice:
netsh http delete iplisten ipaddress=::
You can also do this manually by deleting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList from the registry and restarting the service/your PC.
I update my Visual Studio to 2019 version and has this problem, I tried all solution from this question but it doesn't help to start my ASP.NET MVC 5 project with IIS Express. After I remove IIS Express (using Control Panel), download last version from www.microsoft.com and install it. After this everything works fine.
After some weeks i got update for Visual Studio and I got this problem again. I remove IIS Express and reinstall and it works fine now.
p.s. repair didn't help me, only uninstall and install.

Resources