Slow startup with IIS Express
Asked Answered
A

9

43

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?

Abreaction answered 27/5, 2014 at 4:6 Comment(5)
possible duplicate of Fixing slow initial load for IISTressietressure
Related: programmers.stackexchange.com/questions/97538/… and programmers.stackexchange.com/questions/54069/…Tressietressure
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.Tressietressure
But is it possible to keep IIS running? Because it restarts every time hit F5Abreaction
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.Relegate
E
39

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" />
Eliseelisee answered 27/1, 2016 at 20:40 Comment(1)
This shaved a few seconds off my startup time.Stinnett
R
12

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 :)

Radiative answered 25/11, 2016 at 10:53 Comment(1)
For my environment (VS 2019 or VS 2022, Win11) excluding the directory %USERPROFILE%\AppData\Local\Temp\Temporary ASP.NET Files from antinvirus scanning did the trick.Fernando
B
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.

Burrus answered 28/11, 2016 at 6:11 Comment(0)
I
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.

Inhumanity answered 20/8, 2015 at 23:9 Comment(1)
Thank you very much, this has bugged me for so longSemipostal
R
5

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
Replenish answered 26/2, 2020 at 16:48 Comment(1)
In my case enabling "Enable Just My Code" reduced start-up times from ~2 minutes to ~6 secondsNoni
T
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.

Tratner answered 16/4, 2015 at 15:45 Comment(0)
T
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();
  }
Teddytedeschi answered 11/8, 2020 at 8:21 Comment(0)
L
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.

Lumber answered 7/8, 2018 at 14:4 Comment(0)
H
0

Based on @Korayem's answer, I removed these lines from IIS config files and get normal load.

<section name="aspNetCore" overrideModeDefault="Allow" />
<add name="AspNetCoreModule" image="%IIS_BIN%\aspnetcore.dll" />
<add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" />
Haveman answered 19/12, 2023 at 17:50 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.