Saturday, August 2, 2008

Sharepoint Architecture - IIS 6.0, ASP.NET & ISAPI

IIS 6.0

  • ASP.NET & WSS rely on IIS 6.0 to supply the underlying listening mechanism to process incoming HTTP requests and supply a management infrastructure for launching and running worker processes on the web server.
  • IIS can handle request coming in over:
    • A specific IP address
    • Port number
    • Host header

IIS Market Share

  • Since April 1996 Apache has been the most popular HTTP server on the World Wide Web. As of June 2008 Apache served 49.12% of all websites.
  • Microsoft Internet Information Services is a set of Internet-based services for servers using Microsoft Windows. It is the world's second most popular web server. As of June 2008 it served 35.39% of all websites.

IIS 6.0 installation

  • When you install IIS 6.0 on Win Server 2003, the following files and directories are installed:
    • C:\windows\System32\InetSrv
    • C:\InetPub
    • C:\windows\Help\IISHelp
  • The following accounts will be created:
    • IUSR_computername
    • IWAM_computername

Account

  • For classic ASP applications:
    • The account which anonymous users are running under is IUSR_computername.
    • If Application Protection is set to High (Isolated ) and you are using Anonymous Access, the account that IIS is using is the IWAM_computername account.
  • For ASP.NET applications:
    • ASP.NET will run under ASPNET account. This account will be used by the ASP.NET worker process (aspnet_wp.exe). On Windows Server 2003, ASP.NET will run under "Network Service".
    • With ASP.NET Impersonation Disabled, the account which anonymous users are running under is ASPNET or Network Service account.

ISAPI Extensions & Filters

  • The Internet Server API (ISAPI) is an N-tier API of Internet Information Services (IIS). ISAPI consists of two components: Extensions and Filters, and they must be written in unmanaged C++.
  • When a request comes into Microsoft's IIS Web server its extension is examined and, based on this extension, the request is either handled directly by IIS or routed to an ISAPI extension.
    • Simple scenario: IIS simply maps an incoming request to a physical file within the root directory of an IIS web site or virtual directory, such as loading a static html page or an image file.
    • Sophisticated routing scenario: IIS also supports ISAPI, so that an incoming request triggers the execution of custom code on the web server.
  • ISAPI Extension
    • An ISAPI extension is a DLL. IIS can map incoming requests to a set of endpoints that trigger the execution of code within an ISAPI extension DLL.
    • Whenever an extension is accessed (e.g., http://www.test.com/myextension.dll?ID=1), IIS checks to see whether the DLL is loaded into memory. If it is not, then IIS will load the DLL which will be loaded to memory once, no matter how many clients are going to use it at the same time.
    • Can be configured at level of an IIS web site or virtual directory
    • When you install the .NET Framework, an ISAPI extension named aspnet_isapi.dll is automatically registered for handling requests for the .aspx extension. When a user makes a request for a page with the aspx extension, IIS will pick up the request and passes it to the aspnet_isapi.dll ISAPI extension. (Image 1)
  • ISAPI Filter
    • An ISAPI filter is a DLL the server calls on every HTTP request. It plays the role of an interceptor
    • Usage:
      • Custom authenticatio
      • Request logging
    • Can be configured at the level of the IIS web site

(Image 1)

IIS 5 vs IIS 6

  • IIS 5
    • When a request comes in, inetinfo.exe process in IIS 5 hosts aspnet_isapi.dll and forwards the request to it. The aspnet_isapi.dll will create a new instance of aspnet_wp.exe worker process. This process will host the .NET runtime and forward the request to it.
    • Because the aspnet_isapi.dll and .NET runtime are in two separate processes, they use a named pipe to communicate.
  • IIS 6
    • IIS 6 doesn’t directly host aspnet_isapi.dll, instead IIS 6 always creates a separate instance of w3wp.exe worker process and all processing occurs inside of this process which hosts both aspnet_isapi.dll and the .NET runtime.This improves the performance because no named pipe is needed.
    • IIS uses a device driver named HTTP.SYS to route incoming requests to the proper application pool.


References:
Apache HTTP Server
Internet Information Services
Internet Server Application Programming Interface
What an ISAPI extension is?
A low-level Look at the ASP.NET Architecture
Inside Microsoft Windows SharePoint Services 3.0
How Do I Determine the Security Account that IIS Uses to Run My Web Site?
Professional ASP.NET 2.0 Server Control and Component Development
blog comments powered by Disqus