Faster Performance of Deployed ASP.Net Sites

This article provides a few tips to ensure your deployed ASP.Net always runs with the best possible performance and no security information leakages.

1. Machine.config

In Machine.config introduce the following (if not already there).

  Machine.config:   

  • Introduce:

     <system.net>
    <connectionManagement>
      <add address="*" maxconnection="100" />
    </connectionManagement>
  </system.net>

  • Modify:

   <processModel autoConfig="true"/> 

     To:

    <processModel autoConfig="false"

                       maxIoThreads="100"
                       minWorkerThreads="40"
                       maxWorkerThreads="40"
                       minIoThreads="30" />

//-- The above would be specific to your Web Server's Configuration. This was suitable for my requirements.

  •  Modify : In Green

<section name="deployment" type="System.Web.Configuration.DeploymentSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly"/>

    To:  In Red

<section name="deployment" type="System.Web.Configuration.DeploymentSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>

2. Web.config

In the Web.config do the following:

A) Under <system.web> key Introduce :

<deployment retail="true"/>

This can be done only after allowDefinition="MachineOnly" inside the "Deployment" key has been set in the Machine.config (see the above).

B) Modify:

    debug =false

in other words:

<compilation debug="false" strict="false" explicit="true">

2)  Cache expiration-HTTP Headers

In IIS: Select your website, right-click any static folder inside your website, as in the example images. Do the following:

            Select "HTTP Headers"

            Enable content expiration

            Set A Value for "Expire after " say 10 (in days)

 

Do this for all the static folders, in other words whose content does not change very frequently .

 


3)  GZIP-enable

Lastly is GZIP Compression, that can shrink a site's pages by 70% to 90%. The advantages are:

  1. Reduced bandwidth
  2. Faster page loads for your visitors. 

Follow this procedure to enable GZIP:

    1. Edit on Metabase.xml while the server is active. Its location is: "C:\WINDOWS\system32\inetsrv"
    2. Find the "<IIsCompressionSchema />" section and add the file types that are in your system.  For mine it was js, dll, aspx, html, CSS, exe and axd. This will look something as in the following:

<IIsCompressionScheme    Location ="/LM/W3SVC/Filters/Compression/gzip"
        HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
        HcCreateFlags="1"
        HcDoDynamicCompression="TRUE"
        HcDoOnDemandCompression="TRUE"
        HcDoStaticCompression="TRUE"
        HcDynamicCompressionLevel="0"
        HcFileExtensions="htm
            html
            txt"
        HcOnDemandCompLevel="10"
        HcPriority="1"
        HcScriptFileExtensions="asp
            dll
            exe
            aspx
            js
            css
            axd"
    >
</IIsCompressionScheme>

Please note that attribute above HcOnDemandCompLevel; this is the Compression level that is set as 10.

Finally, restart IIS.


Similar Articles