search
top

Running ASP.NET on Apache 2.2

Continuing with running Apache 2.x on Windows systems (Windows 7 and Windows 2008 R2) I found the desire to be able to deliver ASPX pages on the Windows server in my development environment. Upon searching the Internet I came across an Apache module mod_aspdotnet.so found here. The module is no longer being actively updated but works well on Apache 2.0 – 2.2 installations.

This implementation is limited  and true ASP hosting should be done with IIS, but no one said we couldn’t have a try at it!

Download mod_aspdotnet-2.2.0.2006-setup-r2.msi but do not double click to run the installation. Instead we need to extract the contents to a temporary directory and will manually copy Apache.Web.dll and mod_aspdotnet.so to the correct directory’s. The reason is that double-clicking will not put the Apache.Web.dll file in the correct location and will register with the GlobalAssemblyCache.

Open a command prompt and change to the directory where you downloaded the file to and run the command.

msiexec /a  /qb TARGETDIR=

Example:

msiexec /a mod_aspdotnet-2.2.0.2006-setup-r2.msi /qb TARGETDIR=c:\temp

The files will be extracted into

First, copy mod_aspdotnet.so to your Apache modules directory c:\Apache2\modules next copy Apache.Web.dll to the c:\apache2\bin, assuming this is where you have installed Apache.

Modify Apache’s httpd.conf file and add this section to the end of the file.

# asp.net support
LoadModule aspdotnet_module modules/mod_aspdotnet.so

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
licx rem resources resx soap vb vbproj vsdisco webinfo

AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" \
"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"


Options FollowSymlinks
Order allow,deny
Allow from all

# Create Temporary ASP.NET Files directory under .NET framework 2.0.
AspNetMount /asp "C:/apache2/htdocs/asp"
Alias /asp "C:/apache2/htdocs/asp"

# Allow asp.net scripts to be executed

Options FollowSymlinks Indexes
AspNet Files
Order allow,deny
Allow from all
DirectoryIndex default.htm default.aspx

Save the changes and restart Apache service, hopefully the service will restart without errors. Now we need to test the setup, in the Directory directive I have created a test asp site.

Open your editor of choice and paste in the following code. This will display the .NET version.

<%@ Page Language="VB" %>





ASP.NET Version


Save the file as default.aspx in the c:\apache2\asp\ directory.

Hope this works for you as it did for me. This will only work on Apache 2.0 / 2.2.

4 Responses to “Running ASP.NET on Apache 2.2”

  1. suanmeiguo says:

    Hi did this really work? I did this the same as your post. But I cannot restart Apache, it shows “The requested operation has failed!”

    Have any idea what’s going on?

    • newlife007 says:

      It did work and I did have issues. This module is not being supported by the developer and is limited in what it does and the stability. I was able to get the test page to work but nothing else. It was really an experiment to see if it would really work. If you want ASP.NET you really want to use IIS. The module has to load exactly and if not it will cause Apache not to load.

  2. olawale says:

    can it work on Apache2.4? if not, how can make it work?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top