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-22.214.171.1246-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 mod_aspdotnet-126.96.36.1996-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" %>
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.