This is a quick and dirty HowTo ASP.NET on the popular Apache Webserver. It works with ASP.NET v1 and ASP.NET v2!
1) Download and install mod_AspDotNet
2) At the end of your httpd.conf file add the following lines:
#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
<IfModule mod_aspdotnet.cpp>
# Mount the ASP.NET /asp application
AspNetMount /SampleASP "c:/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:/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
<Directory "c:/SampleASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex index.htm index.aspx
#default the index page to .htm and .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>
#asp.net
3) Continue with creating C:\AspNetTest.
4) Create a file “index.aspx” and add the following lines to it:
<%@ Page Language="C#" %>
<html>
<head>
<link rel="stylesheet"href="example.css">
</head>
<body>
<form>
<% for (int i=0;i<5;i++= { %>
<font size="<%=I%>"> Sample ASP.NET TEST</font> <br>
<% } %>
</form>
</body>
</html>
5) Restart Apache and visit http://localhost/AspNetTest – it should be working!
Hope that helps..
6 comments ↓
A pretty nice HowTo.
Thats the comfortable part of Apache. Just editing one file. Works even with the current versions of Apache, although the developers have splitted the httpd.conf in seperated files – for what reasons ever.
So long
Johnny
It s working well, but not with codebehind 🙁
I tried with ASP.NET2
See u
Eric
Link to mod_AspDotNet is broken for me :/ i just wanted to try it out but i got iis so i guess ill survive
when i try to visit my SampleASP page i allways become this:
Server Error in ‘/SampleASP’ Application.
——————————————————————————–
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a “web.config” configuration file located in the root directory of the current web application. This tag should then have its “mode” attribute set to “Off”.
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the “defaultRedirect” attribute of the application’s configuration tag to point to a custom error page URL.
have any ideas ?
I could run My ASP.NET pages on apache Server
Thank You Very much
Hi!
Thank you for this tutorial! I have ASP.NET run on Apache.
But I can’t find information about mod_aspdotnet Silverlight support.
Now when I’m opening my site in the browser I get an error with message “Could not load file or assembly ‘System.Web.Silverlight’ or one of its dependencies”.
Question: Is it possible to run Silverlight3 site with mod_aspdotnet?
If possible: what I must to do to make Apache find SL libraries?
Thanks!
Leave a Comment