Configuring Apache for ASP.NET June 25, 2008
Posted by tuse in : ASP.NET, Technical , 3 commentsAs I mentioned in my first post, we will be running an Apache server using WAMP. Apache does not natively support ASP.NET pages. Whenever you preview an ASP.NET page from Visual Studio, it opens the page in the ASP.NET Development Server. However, in order to deploy the page on a network, you would need a server capable of processing ASP code.
So how do we configure Apache server so that it can serve ASP pages? For this, you would need an Apache module. You can get it here
Since our Apache came from WAMP, the default installation path for the module will need to be changed to “C:\wamp\bin\apache\apache2.2.8″ (or wherever your Apache is installed)
Next, you need to modify your httpd.conf file (the configuration file for Apache). To do so, Left Click your WampServer speedometer (the icon which appears in your taskbar whenever Wamp is running) -> goto Apache and there you can see the httpd.conf file. Add the following code anywhere in the file but make sure it does not fall inside the existing <IfModule> </IfModule> tags-
#asp.net
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
# Mount the ASP.NET /asp application
AspNetMount /SampleASP "C:/wamp/www/SampleASP"
#/SampleASP is the alias name for asp.net to execute
#"c:/SampleASP" is the actual execution of files/folders in that location
# Map all requests for /asp to the application files
Alias /SampleASP "C:/wamp/www/SampleASP"
#maps /SampleASP request to "c:/SampleASP"
#now to get to the /SampleASP type http://localhost/SampleASP
#It'll redirect http://localhost/SampleASP to "c:/SampleASP"
# Allow asp.net scripts to be executed in the /SampleASP example
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex index.htm index.aspx
#default the index page to .htm and .aspx
# 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"
Options FollowSymlinks
Order allow,deny
Allow from all
#asp.net
Next, in your Wamp www folder (the default folder where all website data is stored), create a folder named sampleASP and paste your ASP Website data there. In case you need to change the folder, modify the entires appropriately in the code snippet (i.e change it from
“C:/wamp/www/SampleASP” to the name you want).
On doing this I got the following error-
The current identity (NT AUTHORITY\SYSTEM) does not have write access to ‘C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.
To correct this, create a folder “C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files” and set permission to write to it.
As I have told you,
I am using Visual Studio 2008 Professional with Apache 2.2.8 (WampServer 2.0) on a Windows Vista machine.
One of my buddies on Windows XP did not get this error.
So once this is done, you have successfully configured your Apache to run ASP.NET pages.
As a check you should see a check mark in
‘aspnet_modules’ in the WAMP Speedometer under Apache Modules.
