Reputation: 16278
I'm new to ASP.NET so I might be missing something in the picture. I'm using Visual Studio Community Edition, working in Code First mode, which I read uses IIS Express on my machine and LocalDB.
Issue is, each time I click on any link, let's say /Student/Index
, it takes about 10 to 15 seconds to load and sometimes even more. I'm running the web app by pressing the green arrow (F5) which should attach a debugger, is that the reason it is so slow or am I missing something else?
PS: I'm following this tutorial so I'm scaffolding every controller.
Upvotes: 3
Views: 3116
Reputation: 239290
Yes. That is why it's slow. There's a lot that has to happen to allow debugging and all that takes time. Plus, by starting and stopping debugging, you're also starting and stopping IIS Express each time if your project has the default of setting Enable Edit and Continue
checked. In other words, each time you start debugging the whole IIS and ASP.NET machinery has to spin up completely fresh before all the work of attaching the debugger even begins.
First, check the properties of your project and if Enable Edit and Continue
is checked, uncheck it. Then, when you stop debugging, you can actually continue to browse your development site without having to debug again. This is great for things like HTML/JS/CSS changes because it allows you to instantly reload the page, and as long as you remember to rebuild when you make C# code changes, you can even reload the page to see those changes without having to debug again. In this way, you will only need to actually run in debugging mode if you truly need to step into your code line by line and inspect variables. Otherwise, just run once and reload.
Also, there's an option somewhat buried, to just run the site without debugging. Right-click your project in the Solution Explorer, go to View > View in Browser. This will start up IIS Express, but not all the debugging machinery.
Upvotes: 8