Saturday, August 8, 2015

ASP.NET MVC / IIS - Optimizing Web Application Performance

Optimizing your web sites in ASP.NET MVC for performance includes cache busting, enabling caching for static resources, enabling gzip compression. To enable caching on static resources, you will need to add the following XML in your web configuration file in the system .webserver element. The control max age parameter determines the length of time to cache the static resources.

 ...
 
  ...
   
   
 

In an effort to compress dynamically generated content (ASP, PHP, ASP.NET) and static files (PDF, JPEG, etc.), you can enable the following settings within your application web configuration. As you use <urlCompression> to define what is compressed, you can use <httpCompression> to define how it is compressed.

      
    
      
      
        
        
        
        
        
      
      
        
        
        
        
        
        
      
    
 

Utilizing Cache Busting can be done to ensure users do not need to clear their browser cache (temporary internet files, etc.) to see changes. Enabling this within the BundleConfig, script and style bundles, when bundles are rendered, will include version numbers. You will want to ensure the following module is added within the web configuration.

 
 

Within your BundleConfig.cs file, you will need to utilize:
BundleTable.EnableOptimizations = true;
Post a Comment