Default ASP.NET Core MVC project won't run - debugging

I created a new ASP.NET Core MVC project with Visual Studio 2019, using the built in default template. I simply ran the project by clicking the green 'play' arrow where it says "IIS Express" (or by pressing F5). I haven't modified anything, yet when my browser opens up (in this case, Microsoft Edge) I get this:
Can’t connect securely to this page
This might be because the site uses outdated or unsafe TLS security settings. If this keeps happening, try contacting the website’s owner.
Your TLS security settings aren’t set to the defaults, which could also be causing this error.
I've opened a 'ticket' with Microsoft, but haven't heard anything yet. It may be that there is an issue with my IIS Express installation, but I'm not sure how to figure that out. I normally prefer to run my ASP.NET MVC local development from my local IIS, but it seems that IIS Express is the default way for Core MVC.

I modified my install of Visual Studio 2019 by removing all the web (ASP.NET) components, and then modified it again by adding them. After this, the default ASP.NET Core project does indeed work and debug with IIS Express.
I don't know how my install became corrupted, but it must have been from one of the numerous Visual Studio updates that seem to be released every few days.

Related

Visual Studio Debugging is stuck at "Attaching to the web server"

When I run my Web API application I get the following window:
It just stays like that indefinantly, until I hit cancel.
When I do hit cancel, this error message is shown:
I have tried rebooting, and running iisreset /restart but it does not fix it.
Any ideas what I can do to get my debugger working again?
NOTE: My Web API 2 project's Servers setting is set to Local IIS. My service is hosted by IIS and when I am not debugging, it works fine.
A possible fix:
Check the "Enable Just My Code" in Tools->Options->Debug
I just did a reset for all the settings for VS and it worked again.
Tools => Import and Export Settings => Reset All Settings
good luck!
I had this issue for Visual Studio 2017 and like with the previous post I had Debugging option "Enable .NET Framework source stepping" ticked. Un-ticking fixed the issue.
So as I commented before I had this same issue, but I now figured out the cause and have a solution.
I just got a new machine last week (this issue was actually one of the reasons why) and after a while I had the same issues, not being able to debug my projects. Luckily because I was installing all the updates one by one I was able to pin-point when it started happening.
It seems the latest update for the "Microsoft ASP.NET and Web Tools" extension breaks something.
Sadly, uninstalling or reverting the Web Tools extension is not easy: Remove this extension by going to the Windows control panel and modifying your Visual Studio installation. I had to remove Visual Studio completely and reinstall it (repair didn't do the trick).
You can update and install all your extensions as you wish, just make sure that you don't update the Web Tools extension
I tested this on my old machine and it did the trick there as well.
I've also created an Issue on GitHub as I won't be updating the extension until this is fixed, if anybody has additional information please add it to the Issue.
In Visual Studio 2015, go to Tools -> Options -> Debugging and deselect "Enable .NET Framework source stepping". This may relate to an issue with loading symbols, so if you want to keep the ability to debug .NET Framework source, then it may help to search the web for how to clear the symbol cache, or preload it, or set your symbol server, and so on.
In Visual Studio 2017, I just restarted my machine and ran the solution, no other windows opened not even a browser, although visual studio took a long time to open (30+ projects in a solution) the problem did not reoccur.
I had the same issue in VS 2017 and un-checking 'Native code' did the trick. Not sure why it was checked.
In my case I set Debugging ->Symbols -> To "Load Only Specified Modules" to include the symbols for, in my case a devops symbols feed for some internal NuGet packages
Options>Debugging>Symbols>Load Only Specified Modules
By checking the option "Always load symbols where located next to modules" the setting won't mess with the regular/classic debugging in VS for your own code
This way the Symbols are still loading where needed and Visual Studio is not trying to load debugging information for all the IIS .net dlls that were loaded by w3wp
Alternatively it can also be configured to not load symbols for microsoft.*.dll and it will also work.
Didn't see this in the current answers, so thought I'd give my 2 cents in 2022:
What worked for me:
Make sure to check that your IIS application pool hasn't been stopped (and restart it if it is), and then if that's not the case, restart your IIS server.
If you don't where those settings are, open our Internet Information Services (IIS) Manager, Application Pools are in the left-hand column, and restart/start/stop your server is in the right column.

Visual Studio 2013 launches the wrong MVC Application

This seems like a typical Microsoft bug. I have a project that when I click launch despite the fact that it's set as the default project is launches a skeleton MVC app as opposed to the MVC app that I'm currently working on.
To fix the problem I have to close down Visual Studio completely and relaunch my solution. I press f5 or just run the app and it works.
What I find interesting is this mysterious skeleton app which seems to be ASP.NET temporary files is the same port as my project. This happens multiple times a day while developing this particular app on the particular port. Does anybody know why Visual Studio 2013 is doing this?
Okay so this is a Microsoft bug. It turns out the project I'm working on does have identical names to another project that I was working on except in a different codeline. Visual Studio gets all confused and launches the old app in cache instead of the app I'm working on. The only way to fix this it appears it to manually change the port number for IIS Express.
For more information check this out.
https://connect.microsoft.com/VisualStudio/feedback/details/786645/vs-launches-the-wrong-mvc-website-when-two-identically-named-solutions-are-open-at-the-same-time

"Bogus" Web project requires missing web component message for razor

Using Visual Studio 2010, MVC 3 (release version) I'm getting this error when opening a specific project which was a traditional web forms project to which I've added MVC:
"The Web project '' requires missing web components to run with Visual Studio. Would you like to download and install the using the Web Platform Installer now?
ASP.NET Web pages with Razor syntax."
I have MVC installed and fully running. Other pure MVC and another mixed Web Forms/MVC project open without any issue.
Clicking "Yes" appears to go through downloading and installing, but the error remains.
Clicking "No" opens the project, where I have intellisense and syntax highlighting for Razor, all my MVC context items (Add View, Add Controller, etc.). In short, everything appears to be working just fine except for what appears to be a bogus error message.
I've done a file compare of the sln, csproj and web.config files and added everything that appears relevant. Prior to doing that I was missing some entries in ProjectTypeGuids the addition of which got the MVC context menus and Razor intellisense working. I tried resetting the ProjectGuid but I still get the error.
I have also previously gone through uninstalling MVC3, MVC2, ASP.NET Web Pages, repairing Visual Studio, installing MVC 3 from the stand-alone installer, and probably a couple more things. I have not yet tried a full system reinstall. I am working from a relatively clean Windows 7 installation. It was a fresh setup about 2 weeks ago and only VS 2010 has been installed (no older versions or betas).
I'm out of ideas at this point. Anyone got any suggestions? I'm a bit confused since this is project-specific, yet the error message indicates that the problem is with Visual Studio.
Update: it gets a little more interesting. Another developer was able to open the same project on his machine without any errors or warnings. So it's something specific to this project on my workstation. At this point I'm willing to write it off as some obscure edge-case bug.
Update 2: And now after rebooting for a system update it's working on my workstation. Definitely some sort of edge-case, and definitely not something I can reproduce.
You can see from the updates, that the problem has gone away after a system-update prompted reboot. So if anyone else has ended up here with a similar problem and you've gone through all the other possibilities, try rebooting.

Exception when Deploying to SharePoint 2010 from Visual Studio 2010

I've done MOSS 2007 development for some time, and am just starting to get my feet wet with SharePoint 2010. I created a SharePoint project, added a Visual Web Part, and typed "Hello, World!" into the web part's user control.
Everything works fine the first time I deploy the project (by selecting Deploy from the project's context menu in the Solution Explorer). It deploys the project, activates the feature, and the web part is immediately available for use.
However...
The second time I deploy the project, I get an error in the Error List stating:
Error occurred in deployment step
'Recycle IIS Application Pool':
Invalid namespace
Now, if I go to SharePoint and manually delete the web part, deactivate the feature, and retract the solution, I can deploy from Visual Studio again; the error seems to only occur if the project has been deployed at least once.
I think I'm missing something obvious here. Any recommendations?
I found the answer!
But not on the Web, so I'll post it here as I did in a related posting on SharePoint.SE.
Apparently, VS 2010 uses WMI to control IIS during a redeploy. Without the features enabled, I got the error described above.
The solution was to: open the Turn Windows on or off menu in the Control Panel (under Programs), and enable WMI compatibility. The path to the feature is:
Internet Information Services -> Web
Management Tools -> IIS 6 Management
Compatibility -> IIS 6 WMI
Compatibility
Edit: For reference sake, this article has screenshots of which features should be activated on Windows 7 to support SharePoint.

ASP.NET Development Server Restart EVERY Time

If I make a change in my ASP.NET project using VS2008 or VS2010, I must stop the ASP.NET development server and restart it (usually by "View in Browser") to see the change reflected.
I'm having the exact same problem as this guy:
ASP.net development server needs restart every time
Except for me, his solution doesn't work: adding/changing the registry value at HKLM\Software\Microsoft\ASP.NET\FCNMode to 0 or 2 does nothing that I can see.
Now the crazy part -- I just upgraded to VS2010 assuming all of my problems would be solved. I migrated my project to .NET 4.0 and did my "View in Browser" only for the exact same behavior to occur! 4.0 runs a completely different version of WebDev.WebServer, I thought for sure this would solve my issue! Nope.
THEN I read about IIS Developer Express, just being released with WebMatrix, and I find how to get my website to load (command prompt) only for, you guessed it, the same issue to happen. I have to kill the server and restart for my changes to be seen.
And the changes I'm talking about don't have to be code updates, they could be a simple HTML modification. The server isn't recognizing the change and thus isn't serving me the new page. CSS or JS files can be updated and seen without restart.
I'm just looking for some ideas as to what could be the problem. Thoughts, please!?
Workstation: Win7 64-bit, VS2008 and VS2010.
So the answer was with the FCNMode, but on Windows 7 64-bit the registry location is different, HKLM/Software/Wow6432Node/Microsoft/ASP.Net
I changed the FCNMode setting from 1 to 2 and without rebooting loaded everything up just fine.
Thanks to Brian over at the ASP.NET Forums for the solution!
http://forums.asp.net/p/1516728/4017980.aspx#4017980
I generally avoid using Cassini and configure my projects to use IIS 7 instead. Any reason why you can't use IIS directly?

Resources