Thursday, November 18, 2010

Part 2/3 -Running Apache Webserver, PHP, MySQL, Perl, CGI and ASP script without IIS on your Windows Box !!!

In order for ASP.net to work, we need to have a .NET Framework, this is normally pre-installed on all current MS machines. Otherwise, go ahead and download the DOTNETFX framework from Microsoft .NET

In my setup I used Microsoft .NET Framework Version: 2.0, but I suppose any version would be compatible.

Now install mod-aspdotnet for Apache HTTP Server 2.2.X where X is the number of my version. Generally forward and backward compatible through all X. At least I had no problems :)

Click on Browse and navigate your way to install at location folder C:\wamp\bin\apache\apache2.2.X where X is the number associated with your Apache version. Continue installation till finished successfully.


After opening the Apache httpd.conf file, we will add a line to enable the file httpd-aspdotnet.conf, and the best place is right after Virtual Hosts.


# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
# ASP.net
Include conf/extra/httpd-aspdotnet.conf


Now create a new file called httpd-aspdotnet.conf which is saved in folder C:\wamp\bin\apache\apache2.2.X\conf\extra where X is the number associated with your Apache version

# Load asp.net module
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"

# Set asp.net extensions
AddHandler asp.net asp 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 /ASP "C:/wamp/www/ASP"

# Map all requests for /ASP to the application files
Alias /ASP "C:/wamp/www/ASP"

# Allow asp.net scripts to be executed in the /ASP folder
<Directory "C:/wamp/www/ASP">
# Set asp.net options
Options Indexes FollowSymLinks Includes +ExecCGI
# Set asp.net permissions
Order allow,deny
Allow from all
# Set asp.net default index page to .aspx and .htm
DirectoryIndex index.aspx index.htm
</Directory>

# Set 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>



Create a folder inside folder C:\wamp\www and here we have folder ASP. Under this subfolder

Now create a new text file hello.aspx
<%@ page LANGUAGE="VB" %>
<html> <head>
<body>
<center>
<% Dim I as Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Hello, world!</font> <br>
<% Next %>
</center>
</body>
</html>


On running the ASP dotnetfx file from our localhost. A simple hello world output is generated through ASP without IIS

Ok. Go ahead and experiment. This however is the end of this little tutorial.

No comments: