ASP.NET MVC 5 applications really slow to build - c#

I'm getting into ASP.NET, and I'm using MVC 5 to build my applications while I follow some Pluralsight trainings. I noticed that in the video training the instructor's Visual Studio builds really fast, but in my computer, after I modify something, every time I build it usually takes from 90 to 120 seconds for the build to finish and I be able to navigate through my application on the browser.
My laptop isn't super old or slow, since it has a Core i5 with 4GB of RAM and an SSD. I've tried to set the MvcBuildViews attribute to false, but still the problem persists. I'm using Visual Studio 2015 Enterprise with Update 2.
Any ideas on what should be the problem?

Delete everything under
C:\Users\YOUR_USER_NAME\AppData\Local\Microsoft\WebSiteCache
Check here too
C:\Users\YOUR_USER_NAME\AppData\Local\Temp\Temporary ASP.NET Files\siteName

It seems like it was a problem with Visual Studio 2015 Update 2. Once I installed Updated 3 it got way faster to build. I noticed that now the IIS Express isn't closed between builds, so now when I build my MVC projects I usually see the result on the browser in less than 20 seconds.

This is not much of an answer that will solve this problem for you. But, I specifically run into this issue with ASP.NET applications. With one of our solutions we have nearly 60 projects and that takes WAY to long to fully build and debug inside a browser from VS.
How I solved this was to point one of our servers with IIS to the folder that my presentation project builds too. This way when the web project is built I can browse my IIS website and see the changes. The downside to this is I can't actively debug in VS easily.
As far as speeding up VS to build this faster with debugging I have had no luck with my experience. From messing with symbol loads, just my code settings, VS IIS settings, but nothing has truly fixed this for me.

Related

Unbound Breakpoints in Blazor WASM Project

I am unable to debug a WASM project in VS 2022, v17.3.6 do to unbound breakpoints. The breakpoints look fine when not running but become an empty circle with the warning sign inside when running the project. The message is “The breakpoint will not currently be hit. Unbound breakpoint”. Other projects within the same solution can be debugged. Three developers on the team have this issue, one does not. All are now on the same version of VS. We tried a slightly older version of VS 2022 (v17.3.4) and it also had this problem.
Below are several ways I tried to fix the problem using many of the suggestions from other posts.
Cleaned the solution, restarted machine, restarted VS
Changed debug settings in Tools-Options-Debugging-Symbols to
checked Microsoft Symbol Servers
checked NuGet.org Symbol Server
Load all symbols
verified launchsettings.json for this setting: "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
Blazor WASM doesn't hit breakpoint
verified debug properties of the projects - Build-General-“Debug Symbols, portable across platforms”
Added code to delay the project start until everything is built
VS 2022 17.1.3 The breakpoint will not currently be hit
https://learn.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-5.0&tabs=visual-studio#breakpoints-in-oninitializedasync-not-hit-1
Verified https://stackoverflow.com/a/66808469
Deleted .vs folder for the solution, restarted machine, restarted VS
The solution in this case had to do with HTTPS. The developers exhibiting the problem (well, 2 out of 3 of them) have a persistent problem when they launch the app, where ASPNET pops up wanting to install a development certificate. They click yes, and it pops up and says it was unsuccessful. This is annoying but otherwise not something the devs worry about since it's been an ongoing annoyance for months if not years.
We tried many things to troubleshoot the problem, including creating a new Blazor WebAssembly project on the machine that couldn't debug. We were able to debug the brand new project! Upon closer examination, we saw that it was created with no authentication. Creating a second project with Individual User Accounts exhibited the same behavior as the production app - breakpoints could not be bound. While tearing apart the code in the non-working new project (with auth) we finally looked at the two launchSettings.json files and found that one of them had two application URLs (https://localhost:XXXX;http://localhost:XXXY), while the other had only the http URL. We deleted the https URL and suddenly the project could be debugged (and the annoying cert popup disappeared, naturally).
We made the same change in the production solution, removing the https application url, and we were able to debug once more. This fixed all three team members who had been unable to debug. Troubleshooting this issue took at least a dozen developer hours and slowed development for several calendar weeks while the team worked around it, so hopefully this helps someone else with the same issue.
I've had the same problem, breakpoint wasn't being hit when I was using 'dotnet watch' launch profile. I was able to start debugging after changing the launch profile back to the launch profile with a commandName: 'Project'.

ASP.NET Web API 2 minutes to load doc page on new project

I am trying to set up an ASP.NET (.NET framework v4.7.2) Web API. When I debug and try to access the values doc page (/Help/Api/GET-api-Values), it takes between 1.7 min and 2 min to load (time according to the network tab).
I have tried it with and without updating the NuGet packages. I have tried FF and Chrome. I have tried it on my SATA and my SSD. I have re-created the project several times. I cannot get this to go any faster and I have not made any changes or addition to the project at all, all I do is create the project and hit debug. I have checked my resources and I am hovering around 40% CPU and 33% memory so it's not a resource issue. I should also mention that going from the home page to the api list page (/Help) works fine.
Any help would be appreciated
Clean install (or moving to pro) was the solution.
I updated my VS and a SR developer helped me look at the issue during a mentoring session, we could not get it to work so after 40min he suggested a clean install and said to try my pro license while I was at it. I suspect it was the clean install rather then moving to pro but I can't say 100% it was one or the other though. Unless pro lets vs use multiple cores because on community edition it was using 1 core and maxing that core out so my cpu looked ok at a glance but a deeper dive showed issues.

IIS Express prevent reloading when code changes

I've got a pair of IIS Express applications. One of these is extremely heavyweight (20+ second start time on development machines). One of these is extremely lightweight and just serves up scripts.
The problem is that when you build the lightweight application (to rebuild the scripts), IIS Express restarts both of them even though only one changed. I've confirmed that the C# side is actually not rebuilt as the C# did not change; so presumably it's actually a VS feature to do this?
Currently we use an external tool to build the scripts (Gulp) to work around this so you can build from the command line, but we need some MSBuild features so we wish to move back to exclusively MSBuild.
We discussed removing our dependency on IIS Express for the lightweight application that would mitigate the problem, but it turns out this is extremely complicated for us due to how the two interact.
Is there a config flag somewhere we can set which will tell IIS Express not to restart if the code for one application changes?
Turns out this was fixed in VS2017 - our C# side no longer builds, so IIS Express does not rebuild and everything is fine.

Why ASP.NET MVC Application is Unwantedly Loading Bootstrap Multiple Times

My ASP.NET MVC 5 application is too heavy due to the application loading bootstrap and other CSS files unwantedly too many times.
How do you fix this?
Here's a screenshot of a fresh new ASP.NET MVC 5 Project:
On the screenshot you'll see that bootstrap.css has been loaded 9 times. Causing the page to be of total of 1,596.68 KB!
This happens to all my projects even if its fresh (no edits).
I hope you've come across this problem and have an idea how to fix it. Or is it a bug? Anyways, my IDE is Visual Studio 2013 Web Express with Update 4
This link seems to suggest that it is a bug with Firefox developer tools: https://bugzilla.mozilla.org/show_bug.cgi?id=978688
The suggested solutions is to upgrade the browser and do a cache reset, even though your projects are fresh, the css-files might be cached since before.

Visual Studio 2010 local testing server stopped working

Just recently I tried to build my mvc 3 project, however the local server will not load in the browser, it just says that the web page cannot be displayed almost instantly on both IE9 and Firefox...
Strange thing is it was working fine not two weeks ago, I have tried searching google but have not come up with any solutions.
Does anyone know how to fix this?
Thanks,
Alex.
sometime MVC project have a infected build so try these step
try to rebuild , clean and do the disk clean then restart your system. maybe it's possible code work fine.
are you can show browser snapshot then i am sure what was matter with project you trying to run.
Ok after looking high and low I found this article Is Your ASP .Net Development Server Not Working?. It was some changes that were made to my hosts file by a seperate installer, after modifying my hosts file as suggested in the article it once again works.

Categories