Tips and Tricks

Improving Startup Time by Sharing Packages

You can speed up how fast your "less frequently used" sites load by sharing assembles among your sites. You'll also reduce memory consumption on your server.

IIS does some wonderful things to improve your Web site's performance … not all of which improve everything about your site's performance. For example, IIS will keep the components of sites that are seeing lots of requests in memory while swapping out those sites that haven't seen requests for a while. Swapping out the components of those little-used sites also frees up memory on your server for the sites that are left running.

Unfortunately, when a request does come in for one of those less frequently used sites, that request will have to wait while IIS loads all of the site's components. This is especially annoying because those components include packages that have already been loaded by some other site (many NuGet packages, for example; Entity Framework leaps to mind). And, of course, you're now using up memory to hold multiple copies of the same component.

If you're using .NET Framework 4.5 or later, then you can use the aspnet_intern utility to help with this problem. All you have to do on your Web server is to run the command, pointing to the folder where IIS keeps its temporary files. The utility will analyze the folder and -- where it finds three or more copies of the same file -- copy the component to a new location of your choice and direct all the affected applications to use that single copy. Now, when a request comes in for an infrequently used site, IIS will use an already loaded copy of its components rather than loading them again.

Before running the utility, make sure you exercise all the sites involved to ensure the temporary folder is populated with the sites' components. Then run the aspnet_intern command, providing three parameters: mode (set to exec); sourcedir (set to the path to the Framework's temporary folder); and interndir (set to the folder where you want to keep the shared components). A typical example looks like this:

aspnet_intern -mode exec -sourcedir "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files" -interndir C:\Prod\ShareAssemblies

If you want to see if this is worth doing, run the command, but pass "analyze" to the mode parameter. The command will print out a report showing how many shared components there are.

About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at

comments powered by Disqus


  • Death of the Dev Machine?

    Here's a takeaway from this week's Ignite 2020 event: An advanced Azure cloud portends the death of the traditional, high-powered dev machine packed with computing, memory and storage components.

  • COVID-19 Is Ignite 2020's Elephant in the Room: 'Frankly, It Sucks'

    As in all things of our new reality, there was no escaping the drastic changes in routine caused by the COVID-19 pandemic during Microsoft's big Ignite 2020 developer/IT pro conference, this week shifted to an online-only event after drawing tens of thousands of in-person attendees in years past.

  • Visual Studio 2019 v16.8 Preview Update Adds Codespaces

    To coincide with the Microsoft Ignite 2020 IT pro/developer event, the Visual Studio dev team shipped a new update, Visual Studio 2019 v16.8 Preview 3.1, with the main attraction being support for cloud-hosted Codespaces, now in a limited beta.

  • Speed Lines Graphic

    New for Blazor: Azure Static Web Apps Support

    With Blazor taking the .NET web development world by storm, one of the first announcements during Microsoft's Ignite 2020 developer/IT event was its new support in Azure Static Web Apps.

  • Entity Framework Core 5 RC1 Is Feature Complete, Ready for Production

    The first release candidate for Entity Framework 5 -- Microsoft's object-database mapper for .NET -- has shipped with a go live license, ready for production.

Upcoming Events