0

I'm trying to understand what is going on in my app. For the reference I'm running iisexpress.exe x64 and .NET 4.5.2 using ASP.NET MVC. I'm looking at the debug logs in the output window in visual studio and I see a lot of this:

'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-16-131251630950625500): Unloaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\e1b2ad06\364709ab_1e4cd201\VolsImpl.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-16-131251630950625500): Unloaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\56a80de6\c1b89b0f_f641d201\WebGrease.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-16-131251630950625500): Unloaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\988eb89c\006135f2_2c44d201\WPFToolkit.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-16-131251630950625500): Unloaded     'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'

And then maybe, 5 seconds later, this:

'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\176bb93b\80e4a580_2544d201\adppmdlnetwrap.dll'. Cannot find or open the PDB file.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\3e610582\807a1250_2644d201\alglibnet2.dll'. Module was built without symbols.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\5c17d607\596fc1a6_1e4cd201\AmericanOption.Test.dll'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\53755cf8\8ce4c1a6_1e4cd201\AmericanOptionImpl.dll'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-17-131251631150955531): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\05434ba9\152b6c2d_f641d201\Antlr3.Runtime.dll'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\ac1f38f5\801cf661_2a44d201\Apache.NMS.ActiveMQ.dll'. Cannot find or open the PDB file.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\02a1ee63\8000a853_2a44d201\Apache.NMS.dll'. Cannot find or open the PDB file.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-18-131251631350325466): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7bed87d2\52db2cb\assembly\dl3\efc156d2\b33537c7_451fd201\AutoMapper.dll'. Cannot find or open the PDB file.    

I know the assemblies I have there are different and some come from different places like the GAC or asp.net temporary files. But why is this happening? It's incredibly slow debugging my app because of all the assemblies being loaded and then unloaded. I understand there is something called 'lazy loading' that only loads .dlls when they are needed .etc, but these are just seemingly senselessly being loading and unloaded.

Anywhere I can read up on this? Or is something wrong with my app?

Thanks!

EDIT: I notice this is similar to the problem listed here: ASP.NET MVC on IISExpress rebuilding entire site for each request and here: IIS Express loads and unloads modules for each request

In fact, it seems that the app domain is constantly being torn down and recreated at every web request. You can see here:

'iisexpress.exe' (CLR v4.0.30319: Domain 3): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-2-131251647881676169): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-2-131251647881676169): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'

But I can get all the way up to Domain 20.

EDIT: my Application_Start() :

   protected void Application_Start()
    {
        // Disable connections
        Environment.SetEnvironmentVariable("MFL_NO_CONNECTIONS", "true", EnvironmentVariableTarget.Process);
        Mfl.User.SystemTools.InitializeMfl();

        // Register all the mappings from domain/presentation in the whole app.
        AutoMapperConfig.RegisterMappings();

        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);

        log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("~/Web.config")));

        // Add support for inheritance model binding for Request Data and Editing Notes
        ModelBinders.Binders.Add(typeof(BaseRequestDataViewModel), new InheritanceModelBinder());
        ModelBinders.Binders.Add(typeof(NoteTemplateViewModel), new InheritanceModelBinder());

        // Add support for ExpressiveAnnotations for more complex validation rules
        ModelValidatorProviders.Providers.Remove(
            ModelValidatorProviders.Providers
                .FirstOrDefault(x => x is DataAnnotationsModelValidatorProvider));
        ModelValidatorProviders.Providers.Add(
            new ExpressiveAnnotationsModelValidatorProvider());

    }
Community
  • 1
  • 1
coolboyjules
  • 2,300
  • 4
  • 22
  • 42
  • I am using asp.net mvc 5, I don't think I have a startup.cs unless I'm mistaken. I just have the Application_Start method. – coolboyjules Dec 02 '16 at 15:31
  • This might be related: by default, the project is configured to shut down IISExpress-hosted website once you exit debugging mode, which - obviously - means that all of the loading has to repeat next time you launch the debugger. To disable this, uncheck "Enable Edit and Continue" within the "Web" tab of the web-project's properties. – Hari Lubovac Dec 02 '16 at 15:47
  • I like to keep the websites I'm developing running, even when debugger isn't attached and VS isn't necessarily around. The best for this is non-express IIS. But, since IISExpress is more convenient, having that option above disabled, the site will keep running after you at least once F5'ed it from within VS, assuming you then keep the VS-and-the-related-project open. I then like to bookmark the landing page, disable the start action (same tab: "don't open a page"), and test changes by rebuilding and refreshing the browser-page, not necessarily debugging each time. – Hari Lubovac Dec 02 '16 at 15:54
  • Yes but this is not the problem. I don't mind the slow loading time to put in all the .dlls initially into the app domain for IIS. The *problem* is that at *every* web request in the app, iis express tears down the entire app domain and recreates it and rebinds all the assemblies. – coolboyjules Dec 02 '16 at 16:16
  • That's not normal behavior (to load/unload on every request). Can you reproduce on a new/simple web project? If it does reproduce, the problem might be outside of the scope of the project (e.g. iisexpress reinstallation might fix that; of perhaps there is some misconfig within iisexpress's /.vs/config/applicationhost.config file). If you cannot repro, then it's got to be your code (compare web.config and app-wide code, eg in global.ascx.cs, or check if you have some modules/handlers that might have some god-like logic; maybe search for "appdomain"); I'm only guessing at this point. – Hari Lubovac Dec 02 '16 at 16:38
  • it's safe to completely delete everything in "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\", as that gets rebuilt. I don't understand the purpose/necessity of those files myself, but that's how .net sites work, and I doubt spending time to understand that or disable it will do you any good. Those output lines you posted appear for assemblies being lazy-loaded, but once they are loaded, they should be kept in appdomain's memory until the app shuts down. I don't know of any setting that controls app shutting-down besides that "edit and continue" checkbox. – Hari Lubovac Dec 02 '16 at 16:47
  • Yes I think you're right. I have these external libraries that use dynamic assembly resolution. Removing them removes this problem. I don't have this insane reloading of assemblies. What is weird though that even if i take out ALL references /calls to these external libraries and keep them in my output folder, there is still this weird reloading behavior. – coolboyjules Dec 02 '16 at 17:05
  • if those are in-house code, you know where to complain for unconventional behavior. If it's 3rd party, submit a bug and/or look for alternative. :) I can't guess why they would affect the behavior of the app when not-referenced: perhaps you're overlooking their still getting involved somehow via web.config or via another "stealthy" piece of code that you're forgetting about. Assemblies don't have to be necessarily listed in .proj files to be looked for and used. – Hari Lubovac Dec 02 '16 at 17:09
  • Yeah you're right. Something somewhere is trying to load these assemblies... – coolboyjules Dec 02 '16 at 17:23

0 Answers0