April 4, 2014
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
In the previous post, I showed how to disable browser caching of a asp.net page and application using asp.net 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
I have worked on setting up windows servers and then IIS and sometimes I have noticed that IIS does not recognise asp.net 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 asp.net site is run. Html files will still work at this stage.
To workaround this issue, asp.net 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\ .
Run the command aspnet_regiis.exe -i .
This will register asp.net . The following screen shot will appear on command prompt.
December 16, 2013
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 http://www.startssl.com . 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
November 6, 2012
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 asp.net 4 applications. The IIS will not serve pages correctly if asp.net 4 and asp.net 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 asp.net 4.0 for asp.net version.
That's it - you are done. You can run the website. I have noticed in some windows 2003 server that while choosing asp.net 4 as the version, the sites go down. If so, go to Services and restart "World Wide Web Publishing" service.