MVC 4 application render time with Visual Studio 2012 - asp.net-mvc

When I run my mvc application using Visual Studio 2012 on Chrome, my page takes 36s to render - saw this using mini-profiler. When I host the project on a remote server and hit the server for the page, then it takes 36s on the first hit. But on subsequent hits, it dramatically reduces to 1s or less. Any thoughts on why this might be? On the remote server, when we restart the application pool, we are seeing it take 36s.
So question is, is it taking that long because of IIS allocating resources to the site or is there something else wrong with our setup? Our development time is really taking a hit with the amount of time that it takes each time we have to debug our project. Build and then takes 36s each time to render the page we are debugging.

When you say "run", I'm assuming you meaning debug. Debug rebuilds the project and then once it loads the browser, all the standard initialization for a first time load must be done each time. The fact that it takes the same amount of time (36s) as the application pool spin-up on your server seems to bear this out.
FWIW, you only need to debug your project once per Visual Studio session to have IIS Express fire up. Afterwards, you can simply rebuild your project and refresh the browser directly after (without using debug in Visual Studio) to test your changes. And, you only need to rebuild if you made changes to any *.cs files. Razor views, web.config, etc. will reflect their changes on next page load without a rebuild. The only thing you lose doing it this way is the debug ability, obviously enough. You'll just get a standard yellow page of death instead of automatically jumping to the offending bit of code in Visual Studio. But, I've found that unless I actually need to debug, this method is much quicker to develop with.

A few possibilities come to mind:
View Compilation
By default when you work on your project in Visual Studio, the views are compiled on-demand. While 36 sec seems like a very long time to compile the view for the first page, this could be a contributing factor. If your page changes, it has to be re-compiled. To eliminate this as a factor when performing measurements, you can edit your .csproj file with a text editor and change the line
<MvcBuildViews>false</MvcBuildViews>
to
<MvcBuildViews>true</MvcBuildViews>
(this can also be a useful setting in general).
Other Initialization Overhead
If you are doing much initialization when your app starts (perhaps pre-loading some data from a file or database), that initialization must happen every time the web server starts or the app domain recycles. In Visual Studio, I find that the web server can restart at surprising (to me) times. Add some logging to see if you're running startup code during a particular benchmark run, and see how much overhead that is.
Entity Framework
For some reason, Entity Framework runs much slower when debugging. If you're doing a lot of data access through EF, that could account for some of the difference.

Related

What is the purpose of "building" a .NET MVC application if it runs fine without it?

I have a simple MVC Web application in the .NET Framework. To run it, I can click the green arrow ("play" button) in Visual Studio, which does a "build" and starts a Web browser pointing to the application.
Or, I can just start up IIS Express with the proper command line options, and navigate to localhost:8080 in a browser and run the application without a "build".
What is the purpose of "building" the application in Visual Studio if it runs fine without it?
The simple answer is that it doesn't run without the build step; your assumptions are wrong.
However, Visual Studio continuously monitors your source files and compiles them, e.g. to be able to show intellisense suggestions and compiler errors while you type. This means that there are in fact compiled binaries based on your source somewhere, maybe just not in the bin folder under your project root (that somewhere might be in memory, or in some cache location on disk, depending on circumstances out of scope for this question).
It's also very likely that you've previously built your application, resulting in binaries in your bin folder, even if you didn't do it with the purpose of running the application right after. In either case, if you get it working with IIS Express it's because it can find compiled binaries somewhere, and run those.
The main reason to have Visual Studio explicitly rebuild your app when you hit play, is to make sure that you're running the latest version of your code. Sure, it takes a few extra seconds every time you start the debugger, but it's nothing compared to the time you'd lose trying to track down a bug that you've already fixed in your code, but which still manifests in the running application, because the running application is an outdated version. (It also makes things like stepping through the code much less confusing, since, again, the source code on file will always be in sync with the running application.)

devenv.exe hogs CPU when debugging

Short version:
When I debug ASP.NET MVC apps in VS2013 and try to edit razor views or css files, the CPU usage of devenv.exe skyrockets to the point where VS becomes unresponsive. Browser link is turned off, yet this still happens. Restarting debugging doesn't help, restarting VS doesn't help, restarting windows helps only for a short while, before the problem shows up again. How do I fix this?
Long version:
I'm having some trouble with Visual Studio 2013. Namely, after I start debugging an ASP.NET MVC app devenv.exe starts hogging CPU (to the point where Visual Studio becomes unresponsive). Some time ago this was happening only from time to time, but now it happens nearly always.
At first I thought that it was a problem with Browser Link, but the problem didn't go away after I turned it off and closing the browser while debugging doesn't have any effect.
Stopping debugging makes it stop hogging CPU, but it doesn't make the problem go away when I debug the app next time. Restarting VS doesn't help either and restarting Windows only helps for a little while.
The main clue here is that devenv.exe shows low CPU usage while VS window is not active. Switching to VS window makes devenv.exe use more CPU, but trying to do anything in VS (especially editing a razor view or css file) makes the CPU usage skyrocket.
Anyone got an idea what could be causing this problem and how to solve it?
Being unable to edit css and views while debugging is seriously lowering my productivity (the app takes good minute or two to start).
P.S. The app I'm working on right now is a nopcommerce based shop, but I had this problem before while debugging MVC apps that had nothing to do with nopcommerce.
I didn't manage to find the source of the problem, but closing all editor windows in VS seems to make it go away. If there are further lag spikes, restarting debugging might be also a good idea.
Since I didn't see this problem in a new project, it might be related to the sheer size of the solution, the number of files being opened in the editor at one time (though the problem remained even when I left one view open), the time those files where opened in the VS (I'm not entirely sure why this would be a problem, maybe it has something to do with the file history).

Is there a way around restarting my MVC dev server every time I add an asset?

In order to add an asset to my ASP.NET MVC project in Visual Studio, I have to stop my debug server, add the file, and then restart the server. However, once Visual Studio is aware of the file (an image, say), I can change its content using an external app and the debug server will serve up the changes just fine. The same thing applies to renaming files (i.e., you can't while the server is running). When working on a large content-driven site, this gets rather tedious and unproductive.
I presume this has to do with the way that files are packaged up into an assembly in MVC for deployment (by contrast to Rails or local static site generators, where the files are just served off of the file system), so it's understandable. But I'm wondering if there any way around this limitation that would make local site development less cumbersome.
You can start it without debugging using ctrl + F5
This will run the code without the debugger attached, which is how code will run in production. This will also have performance benefits. If you never need the debugger you can even put your project in release mode (instead of debug mode) for even better performance.

Visual Studio debugging/loading very slow

I'm at wit's end. Visual Studio is typically painfully slow to debug or just plain load ("start without debugging") my ASP.NET MVC sites. Not always: at first, the projects will load nice and fast, but once they load slow, they'll always load slowly after that. I could be waiting 1-2 minutes or more.
My setup:
I'm using Visual Studio 2012 Express, currently, but I've had the same problem in Visual Studio 2010 Express as well. My solution is stored on a network drive; specifically, it's My Documents redirected to a network drive, if it matters. (It shouldn't. There are times where my site loads very fast under this setup.)
I load in Internet  Explorer 9 usually, but the same problem happens in Firefox.
This can happen in any ASP.NET MVC project I work on, and it seems to revolve around having DisplayTemplates, which all my ASP.NET MVC projects do. And it's all C# and Razor if that mattered.
Symptoms:
The system will load my symbols hundreds of times. Basically, the following, but there are at least 300 such rows, each with ever-so-slightly different DLL files for the same CSHTMLs:
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_contact.cshtml.22013bb9.xighmhow.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_contact.cshtml.22013bb9.cv5hktkf.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_statuscode.cshtml.22013bb9.1o77hs8i.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_statuscode.cshtml.22013bb9.jja-77mw.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_location.cshtml.22013bb9.l_e9ev_s.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_location.cshtml.22013bb9.b4n59gom.dll', Symbols loaded.
In the above, I've got three DisplayTemplates: "Contact", "Location", and "StatusCode". It appears that IIS is loading symbols twice for each time the display template gets called. Thus, if I'm displaying a table of 100 entries that call all three of these display templates, it's 600 separate symbols loaded.
This isn't a fast operation either. The log files that IIS generates take about 200  ms for each symbol to load. Thus, super-long delays.
What I've Tried:
Debug or Release version, it doesn't matter.
Putting my project on a full IIS implementation on a web server runs it super fast with no problems.
Cassini, IIS  Express 7.5, and IIS  Express 8.0 all have the problem.
Delete All Breakpoints does nothing.
Clean Solution, or deleting the .suo also do nothing.
If I repair IIS  Express/ delete the My Docs\IISExpress folder, or repair/reinstall Visual Studio → the issue MAY go away, but only for a while before it comes right back.
Any advice at all is appreciated.
To answer more questions, yes my machine definitely has horsepower. The infuriating thing is that the same project, with NOTHING altered, can sometimes load very quickly, typically after I repair IIS  Express and delete the My Docs\IISExpress folder. Eventually, "something" happens and it's down to 2 minutes to load again. What I'm working on is not a complicated project. No external libraries or dependencies and my VS.NET has no add-ons whatsoever.
Of note, this machine has Symantec Endpoint Protection, which has a history of causing havoc. But disabling it outright (it's good to be an administrator) did not fix the problem.
I have a theory at this point. I'm thinking this is all because I'm working off a redirected folder off a network share. While the debugger was going through its hundreds of "loaded symbols" lines, I paused to see what it was doing. It was in my code, loading the DisplayTemplate I had. Stepping into the template output this:
Step into: Stepping over non-user code 'System.Threading.WaitHandle.InternalWaitOne'
Step into: Stepping over non-user code 'System.Threading.WaitHandle.WaitOne'
Step into: Stepping over non-user code 'System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated'
Step into: Stepping over non-user code 'System.CodeDom.Compiler.Executor.ExecWaitWithCapture'
Step into: Stepping over non-user code 'Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch'
Step into: Stepping over non-user code 'Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch'
Step into: Stepping over non-user code 'System.Web.Compilation.AssemblyBuilder.Compile'
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_statuscode.cshtml.22013bb9.bciuyg14.dll', Symbols loaded.
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.CompileWebFile'
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.GetVPathBuildResultInternal'
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert'
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory'
Step into: Stepping over non-user code 'System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists'
Step into: Stepping over non-user code 'System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName'
Step into: Stepping over non-user code 'System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView'
Step into: Stepping over non-user code 'System.Web.Mvc.ViewEngineCollection.Find'
Step into: Stepping over non-user code 'System.Web.Mvc.ViewEngineCollection.FindPartialView'
Step into: Stepping over non-user code 'System.Web.Mvc.Html.TemplateHelpers.ActionCacheViewItem.Execute'
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_statuscode.cshtml.22013bb9.kwj3uqan.dll', Symbols loaded.
Step into: Stepping over non-user code 'System.RuntimeType.CreateInstanceSlow'
Step into: Stepping over non-user code 'System.Web.Mvc.DependencyResolver.DefaultDependencyResolver.GetService'
Step into: Stepping over non-user code 'System.Web.Mvc.BuildManagerViewEngine.DefaultViewPageActivator.Create'
Step into: Stepping over non-user code 'System.Web.Mvc.BuildManagerCompiledView.Render'
It looks like Visual Studio is recompiling my display template every time it's called, which is again, hundreds of times. My theory is that Visual Studio compiles the file, saves it to the network share, then somehow stamps a new time on it, and Visual Studio then thinks the file has changed. Thus, Visual Studio recompiles it yet again. Only a theory though; I really have no clue.
For one, apparently, I have offline files (this is a desktop computer in an office; I couldn't care less). I'm going to disable, reboot, and retry tomorrow.
Plus, moving my project, as is, to the local C: fixes it. It loads very quickly. But this is not ideal in a work environment. I lose Previous Versions, my code isn't backed up at all unless I manually copy it, and it's no longer shared with anyone.
I can make do with copying it back and forth from C to the network share if it comes to it. It's much more annoying to wait two minutes for every page to load.
Here is how I solved the "slow symbol loading" problem in Visual Studio 2012:
Go to Tools -> Options -> Debugging -> General
CHECK the checkmark next to "Enable Just My Code".
Go to Tools -> Options -> Debugging -> Symbols
Click on the "..." button and create/select a new folder somewhere on your local computer to store cached symbols. I named mine "Symbol caching" and put it in Documents -> Visual Studio 2012.
Click on "Load all symbols" and wait for the symbols to be downloaded from Microsoft's servers, which may take a while. Note that Load all symbols button is only available while debugging.
UNCHECK the checkmark next to "Microsoft Symbol Servers" to prevent Visual Studio from remotely querying the Microsoft servers.
Click "OK".
From now on, symbol loading should be much faster.
Note that if you make any changes/downloads to Microsoft assemblies, you may need to go back into the Symbols dialog box and "Load all symbols" again.
Turning off intelliTrace fixed this for me.
In Visual Studio, Tools -> Options -> IntelliTrace
Then, uncheck the checkbox for "Enable IntelliTrace".
None of this worked for me but I found a Breakpoint on a symbol that was deleted. Seems 2010 was hanging on it. To see if this is your issue do debug->windows->breakpoints If any are in there just delete them.
Saunders, mentioned he checked for that but it was not mentioned in the solutions for this problem. Maybe common knowledge for some, but not all of us.
I deleted the "Temporary ASP.NET Files" folder and my localhost page load improved dramatically. Here is the path... %temp%\Temporary ASP.NET Files\
I experienced the same problem and tried most of the resolutions above. Simply deleting cache and temp files end up working for me.
Try removing the contents of these two folders:
C:\Users\\{UserName}\AppData\Local\Microsoft\WebsiteCache
and
C:\Users\\{UserName}\AppData\Local\Temp (in particular the iisexpress and Temporary ASP.NET Files folders).
This can be set up to happen automatically on logging on to Windows by adding a cmd file to the C:\Users\\{username}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup folder with the following content:
rmdir C:\Users\\{username}\AppData\Local\Microsoft\WebsiteCache /s /q
rmdir C:\Users\\{username}\AppData\Local\Temp /s /q
Do you have enabled FusionLog?
My VisualStudio was very slow to start, open solution and load symbols when start debugging. It was slow only on my machine, but not on other machines.
FusionLog writes tons of log stuff to disk. Just disabling it on RegEdit solved everything, on my case.
This is the FusionLog key on registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
Check ForceLog value (1 enabled, 0 disabled).
I think I may finally at least know the cause, though not the reason why. When the problem started occurring again, I noticed a ton of "conhost.exe" processes orphaned. I would close Visual Studio and they would remain open. Ending task on each of them has finally, reliably solved the problem. [hopefully]
(Just note, conhost.exe isn't a Visual Studio process though Visual Studio uses it. Thus, other users out there may have other applications out there that run conhost.exe. I know my machine doesn't which is why I can safely end task all of them but YMMV.)
As to why this happens? It seems to occur when I open more than one project at once, which I tend to do often, even though I only build and debug one of them at any time.
Edit #1 - This isn't a "silver bullet" unfortunately. It doesn't always work for me. Typically, when things get slow, I just close all of my Visual Studio sessions, then go into the task manager and end any instance of it, conhost.exe, iisexpress.exe Microsoft.VisualStudio.Web.Host.exe and MSBuild.exe I can find.
Typically, after that, when I restart my project it'll then load quickly. But not always.
Really I think the best course of action is probably to not build & debug code off a redirected folder/network share.
Edit #2 - Two years later, and this is still an issue for me in Visual Studio Community 2013, but I did seem to at least find the culprit task: Explorer.exe. Yeah, who knew. The moment I end that task, bam, page loads in a single second.
If I have a Windows Explorer file browser open to my redirected network drive (which is often since that's where my code is), this problem seems to occur. Closing the window isn't enough, I have to kill the whole Explorer.exe task. I could only guess what it's doing...going nuts with file handles?
I can usually use the task manager to start up a new explorer.exe task (I can only take so much alt-tabbing), and Visual Studio will continue to load nice and quick. But if I so much as open Windows Explorer again, it almost always goes back to super-slow-mo.
So, if you've got a redirected network share, give it a shot. It sure beats working locally.
The above are all good solutions and I tried all of them, but got the solution here, which is to
Debug -> Delete All Breakpoints
For me it was IE 9.08.8112.16241. As soon as I used Firefox or Chrome there was no sluggish debugging with F10 or F11. I do not know what the problem with IE is but I officially despise using it for testing now.
Update: I have turned off all IE program add-ons and it is back to full speed. Turning them on one at a time revealed that LastPass (in my case) was the culprit. I guess I do not get to blame MS after all.
Several years into the future...
If you are using Brave you can easily access your extensions and turn them off one at a time (or several) while debugging.
brave://extensions
Just click the toggle slider. Notice that all of mine are on except for DuckDuckGo Privacy essentials. They are not removed, just temporarily disabled.
For me, I implemented this tip which basically drastically improved performance by adding the following two attributes to compilation tag in web.config
<compilation ... batch="false" optimizeCompilations="true"> ... </compilation>
What does batch="false" do?
It makes pre-compilation more selective by compiling only pages that
have changed and require re-compiling
What exactly is the optimizeCompilations doing? Source
ASP.NET uses a per application hash code which includes the state of a
number of things, including the bin and App_Code folder, and
global.asax. Whenever an ASP.NET app domain starts, it checks if this
hash code has changed from what it previously computed. If it has,
then the entire codegen folder (where compiled and shadow copied
assemblies live) is wiped out.
When this optimization is turned on (via optimizeCompilations="true"), the hash no longer takes into account
bin, App_Code and global.asax. As a result, if those change we don't
wipe out the codegen folder.
Reference: Compilation element on MSDN
I had execution perfomance troubles with debugging too and i tried very many options of debugger. In my case huge perfomance achieved when i change this options:
Tools - Options - Debugging - Output Window - (General output settings - All debug output) - OFF
I had problems with slow Visual Studio debugging when "Native Code" debugger was enabled. Try disabling it.
On "Visual Studio 2012" go to:
Project Properties ->
Web ->
Debuggers (bottom of page). ->
Disable all except ASP.NET
Hope it helps.
Similar questions: 1, 2
In my case, it was the .NET Reflector Visual Studio Extension (version 8.3.0.93) with VS 2012. Debugging was taking 10 seconds for each Step Over (F10).
In Visual Studio, go to Tools/Extensions and Updates... and disable the .NET Reflector Visual Studio Extension. Don't forget to restart Visual Studio.
In my case it was
Tools/Options/Debugging/General/Enable JavaScript debugging for ASP.NET (Chrome and IE)
Once I unchecked this, my debug start went from 45-60 seconds down to 0-5 seconds.
One time, after a power outage, I had to face the same slowness problem each time a breakpoint was hit or a Exception was thrown.
I had the vague remembering that the "suo" file (in the same directory as the "sln" solution file) can be corrupted and make everything slow down.
I deleted my "suo" files and everything was ok. The .suo files deletion is harmless and only implies to recreate my windows layout plus the starting project and a few other non critical customizations.
I was also facing this issue, below are the steps that I perform and it works for me always:
Deleting the solution's .suo file.
Deleting the Temporary ASP.NET Files
(You can find it at find it at %WINDOW%\Microsoft.NET\Framework\\Temporary ASP.NET Files)
Deleting all breakpoints in the application.
I don't know if you're still having this issue, but I debug sites in Visual Studio by attaching the debugger to the process itself rather than letting VS do it for me and I have found it to greatly improve times. I use an extension for VS called AttachTo and I have a small article on how I use it here.
I hope this helps.
My slow VS issue was resolved by disabling the Browser Link
If someone notices this behavior coming out of left field, check to make sure you don't have any breakpoints set in web.config. I must have set one with a stray mouse click, and it really slowed down all debug operations.
After spending all day waiting for symbols to load as slow as turtle speed, mixing and switching between all the possible combinations: Just My Code, Caching symbols, Intellitrace, Just-In-Time, killing processes, etc.
My solution was actually to disable the antivirus. Yeah, Windows Defender was slowing my project launch! It would check all the dlls as Visual Studio requested them and slowed the whole symbol load process.
I have to say our machines have great specs to compile the solution really fast, so that was never a problem. We code in VS 2013 Ultimate.
Emptying the symbol cache worked for me.
See: menu bar / Tools / Options / Debugging / Symbols / Empty Symbol Cache
In Visual Studio:
Tools -> Options -> Debugging -> Symbols
Choose "Only specified modules". Click the "specify modules" link, and add a blank module (click the new document button and hit OK).
to Clear cache etc. use Options 1 & 2; for settings/troubleshooting Options 3 & 4, enjoy!
Option 1: Navigate to IIS express , clear cache and sites
cd "C:\Program Files (x86)\IIS Express\"
run this appcmd.exe list site /xml | appcmd delete site /in
run this Del /S /F /Q %temp% - to clear the Userprofile Temp folder.
run this Del /S /F /Q %Windir%\Temp
Also, clear your temp files in %temp% and logout, or reboot
this clears the Windows temp folder. This will delete all the sites, enjoy!
Option 2: remove/recreate the temp folders
Cmd> rmdir C:\Users\\{username}\AppData\Local\Microsoft\WebsiteCache /s /q
Cmd> rmdir C:\Users\\{username}\AppData\Local\Temp /s /q
Option 3: JMC (Just My Code) Option from MSDN
To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.
Option 4: configure the Visual Studio/Disable Common plugin issues
Even more Visual Studio settings
You can also configure the Visual Studio and disable resource-killing features on the environment, cant remember where I got this, but threes some more I will post shortly.
Environment -> General
Uncheck “Automatically adjust visual experience based on client
performance”
Uncheck “Enable rich client visual experience” Check
“Use hardware graphics acceleration if available”
Environment -> AutoRecover
Uncheck “Save AutoRecover information every”
Environment -> Documents
Check “Save documents as Unicode when data cannot be saved in codepage”
Environment -> Keyboard
Set “ForceGC” to ctrl+num1
Set “ReSharper_Toggle” to ctrl+num0 (if ReSharper is used)
Set “ReSharper_EnableDaemon” to ctrl+num8 (if ReSharper is used)
Environment -> Startup
Set “At startup” to “Show empty environment at startup”
Uncheck “Download content every”
Environment -> Synchronized settings
Uncheck “Synchronize settings across devices when signed into Visual Studio”
Asp.net core debugging was painfully slow because of unknown VS extension had replaced default Just in Time debugger.
I have found such message in the OPTIONS\DEBUGGING\Just-In-Time configuration tab (as warning text).
Another debugger has registered itself as the Just-In-Time debugger. To repair, enable Just-In-Time debugging or run Visual Studio repair.
Description: https://msdn.microsoft.com/en-us/library/ssc8234s.aspx?f=255&MSPPError=-2147217396
Returning back the default JIT debugger (just checked Managed option that was unchecked) solve all my problems.
In my case I noticed that disabling my internet connection would make it run as fast as with ctrl-f5, so I went to debug->options->symbols and just unchecked all .pdb locations.
Seems like VS was trying to connect to these servers every time a debug session was launched.
Note that disabling Debug->Options->Debugging->General "Enable source support" or "Require source files to exactly match the original version" wouldn't make any difference.
Similar problem wasted better half of my day!
Since solution for my problem was different from whats said here, I'm going to post it so it might help someone else.
Mine was a breakpoint. I had a "Break at function" breakpoint (i.e instead of pressing F9 on a code line, we create them using the breakpoints window) which is supposed to stop in a library function outside my project.
And I had "Use Intellisense to verify the function name" CHECKED. (Info here.)
This slowed down vs like hell (project start-up from 2 seconds to 5 minutes).
Removing the break point solved it for good.
One thing that worked for me after doing all the above was:
In the Threads window (Debug->Windows->Threads), set Group by to None. This can only be done while debugging.
This was having an impact even after closing that window.
Open the solution folder in windows explorer, close the visual studio, delete .suo file from windows explorer.
Now open the project in visual studio, hopefully debugger will attached/detached fastly.
For me it was conditional breakpoints. Those seem to really slow things down.
Go to your environment variables and look for the key _NT_SYMBOL_PATH.
Delete it.
Voila, worked like a charm.

Cassini stops responding when debugging stops

When developing WebForms web site, I start my project once, Cassini loads and stays loaded until I kill it. Therefore, when I change something (it recompiles in background), and refresh in browser is all it takes to see the changes.
But with MVC, I have to start debugging every time because Cassini is not responding to requests if debugging is not running.
Is it possible to get the same Cassini behavior in MVC as in WebForms?
It isn't usual for this behaviour, even when developing MVC websites. I am able to make changes to non-compiled stuff (aspx,ascx) etc and it'll take effect immediately on refresh. Changing classes will require you to stop debugging so that you can re-compile, and allow breakpoints to work correctly.
Also, whilst isn't strictly an answer to your question, you should strongly consider moving away from the baked-in Cassini web server used when debugging.
For more information on my general hatred of Cassini, please read this previous question.
If you're unable to either install IIS on your machine (because it might be XP Home or whatever), then you should consider either upgrading to XP Professional (where you are limited to running one website only), or Windows Vista, or Windows 7 RC where you can use IIS7 and all the greatness that it provides.
If you can't do any of those, you should consider trying an alternative, such as Ultidev.
I think I found the solution - the trick is to Run project wihout debugging. There is no item for it in Build menu, but keyboard shortcut works (Ctrl+F5 in Visual Basic keyboard scheme).
Cassini starts and remains responsive regardless of debug mode.

Resources