Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

April 4, 2014

In a web page, a lot of content and different types of files are transferred from the server to the client - for example, dynamic content from / mvc, and static content like images, css and javascripts. All these types of files add to performance hit. To avoid some of these problems we can cache the static content to the client browser. So, in this post, I will talk about how to add expire header to the static files.

AppPool Recycling and Performance

In IIS, there is a setting to set the recycling conditions for Application Pools (AppPool). So, what is an AppPool? When a website is run within IIS, it runs within a single worker process (w3wp.exe). Running a single worker process puts a high load on the process. Instead, IIS allows to run multiple worker processes using AppPools. A single AppPool can run one or multiple web applications.

Now, AppPool has a recycle option which basically restarts the process. When the process recycles, the new process is started simultaneously so that no HTTP requests are missed. However, the process kills the data in the memory that the applications stores including cache data, sessions and static variables. Now this is both good and bad. It's good because any outages caused by memory leaks issue will not occur but it's bad there will be a performance hit once the process starts.


To make the above situation worse, the default settings in IIS recycles the AppPool every 1740 minutes that is 29 hours. That is, with default setting, it will recycle today at midnight, tomorrow at 5am, day after tomorrow at 10am and so on. To minimise the performance issue, we should reset the setting to a fixed time when the usage on the server is low. The performance issue will still be there but it will impact a lot less number of people this way.

March 15, 2014

Disable Browser Cache using IIS

In the previous post, I showed how to disable browser caching of a page and application using code. In this article, I will show how to disable caching using IIS. Again, note that, there should be a good enough reason to disable browser caching as it will impact performance for repeat visitors.

To disable caching, I will add the necessary caching directives in the response headers. To start with open IIS, select the site or the virtual directory and then click on “HTTP Response Headers” under IIS subheading.


Then, from the Actions pane, click on Add. A prompt will open up. Type in the values and click OK.


Click Add again to enter the Pragma directive.


And Add another one for Expires.


The Response Headers section should appear like below now.



That’s it – caching will now be disabled for the application on the browser.

January 4, 2014

Register on IIS

I have worked on setting up windows servers and then IIS and sometimes I have noticed that IIS does not recognise straight way. If that happens, the error message - Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list - is displayed on the browser when the site is run. Html files will still work at this stage.

To workaround this issue, will need to be registered again. To do so, open command prompt and change the directory to point to .net framework. In 32 bit system it will be at %windir%\Microsoft.NET\Framework\v4.0.21006\ and in 64 bit system it will be at %windir%\Microsoft.NET\Framework64\v4.0.30319\ .

  1. %windir%\Microsoft.NET\Framework64\v4.0.30319\

Run the command aspnet_regiis.exe -i .

  1. aspnet_regiis.exe -i

This will register . The following screen shot will appear on command prompt.


December 16, 2013

Enable SSL from IIS 7

SSL or Secure Socket Layer is needed for enhanced security on a website. With SSL, websites are viewed on the browser with https. To enable SSL, a certificate must be purchased from authorities. Free or cheap ones are available as well like from . However, after purchasing and setting up the certificate, SSL needs to be enabled from the web server - in this case, IIS.

To enable SSL on IIS, open IIS and then click on site under "Sites" and then click on Bindings from the "Edit Site" section.


If https does not exist, add https by clicking on Add like below. Also, select the certificate to bind https to.


After SSL is added, click on SSL settings within IIS subheading for the website.


On the Settings panel, Choose Require SSL.


That should be it. You should be done now.

November 12, 2012

Configure IIS 6.0 for Wildcard Mapping

Sometimes applications need to rewrite urls for producing user friendly urls and there are still lot of companies that use IIS 6.0. There are frameworks like Dynamic Data and Asp.Net Mvc that would rewrite urls and will not run in IIS 6.0 unless configured. This can be configured within IIS Manager. Once an application is added, it would look like below.

November 6, 2012

Run Asp.Net 4 under IIS6.0

Lately, I have trying to load a few web applications to run under IIS 6 and sometimes it became quite challenging. Eventually, I got them working and here are the steps that I used to run the applications.

Make sure .NET framework 4 is installed. You can do so by checking "Add Remove Programs" from Control Panel.

Once .NET 4 is installed, open IIS and open the Web Sections section. Click "Allow" for Asp.Net 4 if it not already allowed.


After that, create a new app pool that will only contain 4 applications. The IIS will not serve pages correctly if 4 and 3.5 are hosted in same app pool. Default configuration for app pool can be used.


Once the app pool is created, create a virtual directory for the web application. Choose the app pool created in previous step in the App Pool in Virtual Directory section. Open Asp.Net tab, and select 4.0 for version.


That's it - you are done. You can run the website. I have noticed in some windows 2003 server that while choosing 4 as the version, the sites go down. If so, go to Services and restart "World Wide Web Publishing" service.

Reference: Shahed Kazi at