How to setup ASP.Net with IIS

Post Reply
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

How to setup ASP.Net with IIS

Post by Neo » Sun Mar 21, 2010 7:16 pm

Before starting, be sure you have .NET Framework installed. If not, you can install it using Windows Update or download the package and install manually.

ASP runs inside IIS (Internet Information Services). Therefore first you should install IIS (under Windows 2000, Windows XP or Windows 2003), of course if it isn't already installed.
Usually, you can install it from Control Panel / Add or Remove Programs / Add/Remove Windows Components.

Go to Start Menu / All Programs / Administrative Tools / Internet Information Services.
Choose your computer name (local computer) / Web Sites / Default Web Site.
Right click 'Default Web Site' and select 'Properties'. Choose the 'Home Directory' tab and type in the 'Local Path' the path to where you want your files to be stored. For example 'D:\Server\iis'. This is the root of your webserver, this folder will open when you type http://localhost in your web browser.
Below, check the 'Script source access', 'Read', 'Write' and 'Directory browsing' values. Click OK and now let's start the server.

Click on the 'Start item' button to start the service. Be sure you don't have any other server running on localhost, Apache for example.

After the server is up and running you can open http://localhost in your web browser. It should show you an empty list if you don't have any files in the folder specified on the 'Local Path'.

You should now be able to open any .asp file and parse it correctly with your browser. Still, you don't have installed ASP.NET, that means you can't run any .ASPX files.
To install ASP.NET follow the steps:

Go to the place where you installed the .NET Framework:
'C:\WINDOWS\Microsoft.NET\Framework'
there should be a folder similar to 'v1.1.4322' (your version of .NET). Note it and let's continue:

Open the MSDOS Command Prompt (Start Menu / Start / Run and type 'cmd').
At the command prompt type (replace 'vxxxxxx' with your version):

Code: Select all

%windir%\Microsoft.NET\Framework\vxxxxxx\aspnet_regiis.exe -i
After it finishes, you have one more step:

Open 'Run' from 'Start Menu' and type:

Code: Select all

regsvr32 %windir%\Microsoft.NET\Framework\vxxxxxx\aspnet_isapi.dll
Again, by replacing 'vxxxxxx' with your version.
Press OK, wait, and you should receive a confirmation message.

To test it, make a test.aspx file in the folder that you typed in the 'Local Path' ('D:\Server\iis' for example) with the following code:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hello world</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<% 
response.write("Hello World")
%>
</body>
</html> 

Open the page with your web browser using 'http://localhost/test.aspx'.

Further you need a database to work with ASP.NET. Consequently, there is also a guide for installing the Microsoft SQL server available here.
Post Reply

Return to “ASP & ASP.Net”