The Apache HTTP Server Project

The cli subproject stands for Common Language Interfaces. These include only mod_aspdotnet today, but the developers in the cli subproject are looking forward to building additional .NET flexibility into Apache HTTP Server.

This document will introduce you to all of the key concepts you might be unfamiliar with, introduce you to mod_aspdotnet and the purpose it serves, and what you can accomplish with it. This document is a work in progress, feedback is welcome at the cli-users mailing list.

See the cli subproject site for information about mailing lists, other resources and how to participate in these ongoing efforts!

Microsoft's marketing of .NET is a vision encompasing a wide spectrum of technologies, not one specific new technology. This leads to some confusion about .NET development and what web development under .NET really entails.

The deepest underpinning of .NET is a new program execution model, the CLR (Common Language Runtime), which hosts IL (Intermediate Language) code. This model is very similar to Java's JVM running .class'es compiled into Java bytecode. Far different than the classic interpreted script (such as Perl) or compiled machine code (such as C or C++), the CLR enforces rules to ensure code trust, machine security and data integrity. Many languages are already available for writing code to run within the CLR, including C#, and Microsoft's C++.NET, VisualBasic.NET and J#. Many third party companies are bringing additional languages to the .NET managed code world, there are more than 20 different languages shipping today.

Microsoft's .NET Framework includes many core facilities, packaged as language-agnostic classes that can be generally used by any .NET language. It includes the C# compiler, and the ASP.NET related classes.

ASP.NET (known inside the .NET framework as System.Web) is a hosting environment for web applications that provides facilities to query and collect information about the current request, prepare the response, and maintain session state information. ASP.NET simplifies the chore of building web applications down to the essential task of generating and serving content.

The converse question, "are ASP.NET and ASP the same thing?", deserves a resounding answer of NO. Although in some respects they offer similar facilities, they have no relation to each other. mod_aspdotnet only provides the ASP.NET environment, and does nothing for ASP content. Simply put, ASP.NET has replaced ASP, and ASP runs in its own environment(s), (one per scripting language) and not inside the .NET framework.

If you have ASP pages to serve, consider porting them to ASP.NET. There are many fine books and online guides to assist you.

This is actually two modules; mod_aspdotnet.so is an in-process Apache 2.0 module, which starts the ASP.NET engine and hands off requests to the ASP.NET engine. There is a second module compiled for .NET, which is Apache.Web.dll. The Apache.Web.dll is loaded into Microsoft's ASP.NET host environment and dispatches request and response operations back to the mod_aspdotnet.so. This combination of managed (.NET-side) and unmanaged (Apache-side) code, running in the same process as the Apache 2.0 server, attains the optimal performance for serving ASP.NET content. The solution maintains tight compatibility with existing, IIS-hosted ASP.NET, because the same Microsoft ASP.NET hosting environment is running under either of these scenarios.

Multiple ASP.NET virtual webs are supported by the mod_aspdotnet module. A request is directed to the asp.net handler using conventional Apache configuration options, and is mapped to a specific ASP.NET virtual web by matching the requested URI to the AspNetMount directives given for the specific Apache virtual host, uri, and file location. The same AspNetMount can be given in multiple Apache virtual hosts. Any given AspNetMount is created only once for all Apache virtual hosts that share the same AspNetMount, conserving memory and resources.

AspNetMount and other directive changes are processed when the server is restarted. With Apache 2.0, the original Windows child process continues to serve requests until a new child process is ready to process requests itself. This provides minimal interruption of service when modifying the web server configuration. The restart option begins a graceful restart sequence, loading and initializing the new server while the old server finishes fulfilling open requests, and there is no interruption in web services during the transition from the old to the new configuration.

This is not a module for Unix platforms. The Mono project's mod_mono provides very similar features for non-Win32 machines, with their own implementation of ASP.NET for Apache httpd server.

Microsoft's .NET Framework is available as a free download for Windows 2000 or 2003 Professional and Server versions, XP Professional, and .NET Server platforms from http://asp.net/download.aspx. You must minimally install the .NET Framework Resdistributable version, while developers will prefer to install the .NET Framework Software Development Kit, or another .NET development tool such as VisualStudio .NET.

Once you download and install the mod_aspdotnet .msi package, it will install both mod_aspdotnet.so into your Apache2/modules/ directory, and the Apache.Web.dll into the Global Assembly Cache. You then need to modify your Apache2/conf/httpd.conf file to load the mod_aspdotnet.so module, and declare what content you will serve. See the mod_aspdotnet module documentation for the directives to add for a typical scenario, or follow the Example below.

The following configuration will support the Microsoft IBuySpy sample, an illustration of a web storefront. IBuySpy is available as a free download from http://asp.net/ibuyspy/. Note that Microsoft SQL Server version 7.0 must be installed before installing the Microsoft IBuySpy sample. The configuration below illustrates configuration for the C# flavor of the IBuySpy Store sample, installed into the default installation directory:

LoadModule aspdotnet_module modules/mod_aspdotnet.so

# Use the asp.net handler for all common ASP.NET file types
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
                   licx rem resources resx soap vb vbproj vsdisco webinfo 

<IfModule mod_aspdotnet.cpp>

    # Mount the IBuySpy C# example application
    AspNetMount /StoreCSVS "C:/StoreCSVS/StoreCSVS"

    # Map all requests for /StoreCSVS to the IBuySpy application files
    Alias /StoreCSVS "C:/StoreCSVS/StoreCSVS"

    # Allow asp.net scripts to be executed in the IBuySpy example
    <Directory "C:/StoreCSVS/StoreCSVS">
        Options FollowSymlinks ExecCGI
        Order allow,deny
        Allow from all
        DirectoryIndex Default.htm Default.aspx
    </Directory>

    # For all virtual ASP.NET webs, we need the aspnet_client files 
    # to serve the client-side helper scripts.
    AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \
          "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
    <Directory \
          "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
        Options FollowSymlinks
        Order allow,deny
        Allow from all
    </Directory>

</IfModule>

Configuring the VisualBasic.NET version is very similar, simply change the StoreCSVS directory names above to the name StoreVBVS.


Copyright © 1999-2004, The Apache Software Foundation