Slow page refresh times during development

2019-02-16 06:14发布

问题:

We have a reasonably large ASP.NET MVC app that I work on in Visual Studio 2012 on Win 8. I have a strange issue with slow page load times after recompilation. Usually, the actual build time is about 5 seconds, then the browser opens up and it takes 1-2 minutes to load the page.

Some points:

  • It loads slowly whether I change a view or recompile the project completely
  • This is not a performance issue, everything else works really well, there is enough RAM etc.
  • It happens only with IIS Express. When I switch to the default development server, it works fine.
  • All the other devs in my team use IIS Express, but they do not have this problem.
  • I tried to re-install IIS and to use v7.5 instead of v8 and recreated all config files. No luck.
  • I tried to disable all extensions, obviously it didn't affect load times too.
  • There is nothing abnormal in Task Manager
  • It's a virtual machine on my Macbook Pro, but again – this is not a performance problem.

What else can I try?

回答1:

Solved by turning off Windows Defender Service. Everything is a hundred times faster now.

UPDATE: I failed to find a reason why Windows Defender is using lots of CPU power pretty much all the time. I tried to google it and it turns out that many people have a similar problem on Win 8 with no good solution.

If you really want to leave Defender on, you can add the project folder path as an exception, but it still will be slow-ish.

Hope it helps someone.

UPDATE 2: The above still holds true in Windows 10. Especially if you're running it in a virtual machine (I run it in Parallels on Mac). The overall speed increase, not only page refresh times, is very noticeable.

UPDATE 3: Apparently Windows Defender has a habit of silently turning itself back on again. So, be wary of that.



回答2:

After viewing this question and answer above I found that Windows Defender Service was already turned off for me, however, I was running AVG. I disabled AVG and sure enough the lag went completely away!

So if Windows Defender Service is turned off for you and you are running some sort of system protection like AV try disabling that.