41

I have a problem with my MVC application and startup.

Every time I make a change and one the app its take a long time to start up.

I have about 100 lines with ''iisexpress.exe' (CLR v4.0.30319:'

Do I have to start iisexpress every time I run my application?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Jakobbbb
  • 515
  • 1
  • 4
  • 10
  • 1
    possible duplicate of [Fixing slow initial load for IIS](http://stackoverflow.com/questions/13386471/fixing-slow-initial-load-for-iis) – Rowan Freeman May 27 '14 at 04:23
  • 1
    Related: http://programmers.stackexchange.com/questions/97538/why-after-each-restart-my-local-net-sites-take-time-to-load-for-the-first-time and http://programmers.stackexchange.com/questions/54069/why-might-an-asp-net-website-load-slowly – Rowan Freeman May 27 '14 at 04:23
  • I've read a lot about it but as far as I know there isn't much of a solution. There is a lot of overhead with IIS applications and every time you restart one, it takes at least several seconds to get going. – Rowan Freeman May 27 '14 at 05:10
  • 1
    But is it possible to keep IIS running? Because it restarts every time hit F5 – Jakobbbb May 27 '14 at 09:53
  • If you are only making none compiled code changes (i.e. javascript, styles/css, or views), you can just hit refresh instead of F5 to run the app again. This will not stop and restart iis / iis express. – Will Apr 15 '15 at 16:43

8 Answers8

37

I found significant improvement after disabling logging.

Locate the IIS config for your project or machine, typically found in:

  • %userprofile%\documents\iisexpress\config\applicationhost.config
  • .\.vs\config\applicationhost.config
  • VS2019: $(solutionDir)\.vs\{projectName}\config\applicationhost.config

And comment out or delete the following two nodes (found somewhere in the document)

<add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" />
<add name="HttpLoggingModule" lockItem="true" />
Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Korayem
  • 12,108
  • 5
  • 69
  • 56
11

I had this same problem, tested with VS2010 and VS2015. Symptom: VS was quick, compiled, loaded symbols and opened browser within a second but then browser just hung for 5 to 20 minutes. My projects are huge but my laptop is 16GB RAM, i7 and SSD so definitely not a size problem. I tried all the answers on this question and also here Visual Studio debugging/loading very slow.

In the end I found the solution here https://social.msdn.microsoft.com/Forums/en-US/394f3100-bac2-4b1c-8f8c-731226b905d4/painfully-slow-starting-a-web-application-in-visual-studio?forum=visualstudiogeneral

Exclude the directory "C:\Windows\Microsoft.NET\Framework" from antivirus scanning

Hopefully this will save someone else so much wasted time :)

Community
  • 1
  • 1
Martin Belcher - AtWrk
  • 4,579
  • 4
  • 33
  • 41
8

I had the same problem with IIS Express 10, Visual Studio 2015 Update 3 on Windows 10. I did a few tests and with different settings and browsers (Chrome 54, Edge 38, Opera 41). The browser doesn't really matter, but I found three things which significantly changed my original 15 seconds load time:

  1. Switched Windows Defender 4.10 off (changed from 15 to 12 seconds)
  2. Turned Edit and Continue feature off (changed from 12 to 6 seconds)
  3. Switched Windows Defender 4.10 back (changed from 6 to 8 seconds)
  4. Tried to run the application without debugging (changed from 8 to 2 seconds)

So if you are willing to give up Edit and Continue, or even debugging then you can speed up the process.

Edit and Continue can be turned off in Visual Studio/Tools/Options/Debugging/General/Enable Edit and Continue.

You can start your project without debugging with Ctrl+F5.

I would not recommend to turn off your Windows Defender, but you can play around with its exclude directory function, you might win a few seconds there as well.

Andras
  • 430
  • 7
  • 9
6

I had similar problem. When I run the process monitor I found that my fusion log is enabled after disabling fusion log IIS Express loaded the sites without much delay.

Thiru
  • 407
  • 5
  • 7
4

IIS Express should continue to run in the background while you change and compile your code. You can then go to Debug -> Attach Process and find the iisexpress.exe process and attach to it. The problem with hitting F5 every time is that VS tears down the process and restarts it which takes time.

The Pax Bisonica
  • 2,154
  • 2
  • 26
  • 45
4

It may help to check the following Debug options:

Tools > Options > Debugging > General

  • Enable "Enable Just My Code"
  • Disable "Enable .NET Framework Source Stepping"
  • Disable "Source Server Support"
  • Disable "Source Link Support"
  • Disable "Use Managed Compatibility Mode"
  • Disable "Enable Edit And Continue"

Tools > Options > Debugging > Symbols

  • Disable all Symbol file locations
  • Set Symbol cache directory
  • Select "Load only specified modules"
  • Click "Specify included modules" and disable all
marsze
  • 15,079
  • 5
  • 45
  • 61
  • 1
    In my case enabling "Enable Just My Code" reduced start-up times from ~2 minutes to ~6 seconds – mBardos Dec 16 '22 at 14:50
1

You can control it from the Global.asax file by taking advantage of ViewEngines.Engines.Clear().

protected void Application_Start()
 {
        ViewEngines.Engines.Clear();
        ViewEngines.Engines.Add(new RazorViewEngine());
        AreaRegistration.RegisterAllAreas();
        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
        AuthConfig.RegisterAuth();
  }
Swati
  • 234
  • 2
  • 10
0

I was experiencing slow startup of my ASP.NET MVC application using Visual Studio 2017 and IIS Express. I tried almost every suggestion in this thread without any noticeable application startup speed. The one thing that worked was launching the application without debugging using Ctrl+F5. This improved the launch time from 10-20 seconds to just a few seconds. If the browser window is kept open, coding edits can be tested by refreshing the browser. Editing models or controllers require the project to be (re)built whereas changes to views are reflected without a project (re)build.

Guru Josh
  • 566
  • 8
  • 16