Best practices for creating websites in IIS 6.0

Source: Internet
Author: User

Every time I create an IIS website, I do some steps, which I consider as best practice for creating any IIS website for better performance, maintainability, and scalability. here're the things I do:

Create a separate application pool for each Web Application

I always create separate app pool for each web app because I can select different schedule for app pool recycle. some heavy traffic websites have long recycle schedule where low traffic websites have short recycle schedule to save memory. moreover, I can choose different number of processes served by the app pool. applications that are made for Web garden mode can benefit from multiple process where applications that use in-process session, in memory cache needs to have single process serving the app pool. hosting all my application underDefaultapppoolDoes not give me the flexibility to control these per site.

The more app pool you create, the more ASP. NET threads you make available to your application. EachW3wp.exeHas it's own thread pool. So, if some application is congesting ParticleW3wp.exeProcess, other applications can run happily on their separateW3wp.exeInstance, running under separate app pool. Each app pool hosts its ownW3wp.exeInstance.

So, my rule of thumb: always create new app pool for new web applications and name the app pool based on the site's domain name or some internal name that makes sense. for example, if you are creating a new website zabir.com, name the app pool zabir.com to easily identify it.

Another Best Practice: DisableDefaultapppoolSo that you don't mistakenly keep adding sitesDefaultapppool.

First you create a new application pool. Then you create a new website or virtual directory, go to properties-> Home Directory tab-> select the new app pool.

Customize website properties for performance, scalability and maintainability

First you map the right host headers to your website. in order to do this, go to website tab and click on "advanced" button. add mapping for both domain.com and www.domain.com. most of the time, people forget to map the domain.com. thus already visitors skip typing the WWW prefix and get no page served.

Next turn on some log entries:

These are very handy for analysis. if you want to measure your bandwidth consumption for specific sites, you need the bytes sent. if you want to measure the execution time of different pages and find out the slow running pages, you need time taken. if you want to measure unique and returning visitors, you need the cookie. if you need to know who is sending you most traffic-search engines or some websites, you need the referer. once these entries are turned on, you can use variety of log analysis tools to do the analysis. for example, open source AWStats.

But if you are using Google Analytics or something else, you shoshould have these turned off, especially the cookie and Referer because they take quite some space on the log. if you are using ASP. net Forms authentication, the gigantic cookie coming with every request will produce gigabytes of logs per week if you have a medium traffic website.

This is kinda no brainer. I add default. aspx as the default content page so that, when visitors hit the site without any. ASPX page name, e.g. zabir.com, they get the default. aspx served.

Things I do here:

    • Turn on content expiration. this makes static files remain in browser cache for 30 days and browser serves the files from its own cache instead of hitting the server. as a result, when your users revisit, they don't download all the static files like images, javascripts, CSS files again and again. this one setting significantly improves your site's performance.
    • RemoveX-powered-by: ASP. NETHeader. You really don't need it unless you want to attach Visual Studio remote debugger to your IIS. Otherwise, it's just sending 21 bytes on every response.
    • Add "from" header and set the server name. I do this on each webserver and specify different names on each box. it's handy to see from which servers requests are being served. when you are trying to troubleshoot load balancing issues, it comes handy to see if a particle server is sending requests.

I set the 404 handler to some aspx so that I can show some M error message. there's a 404. aspx which shows some nice friendly message and suggests some other pages that user can visit. however, another reason to use this custom mapping is to serve extensionless URL from IIS. read this blog post for details.

Make sure to set ASP. NET 2.0 for your ASP. NET 2.0, 3.0 and 3.5 websites.

Finally, you must, I repeat you "must" turn on IIS 6.0 gzip compression. This turns on the Volkswagen V8 engine that is built into IIS to make your site screaming fast.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.