ASP.NET
  Home arrow ASP.NET arrow Page 5 - Setting Up Internet Information Services a...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Setting Up Internet Information Services and ASP.NET
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2005-11-10

    Table of Contents:
  • Setting Up Internet Information Services and ASP.NET
  • Managing Websites
  • Virtual Directories and Web Applications
  • Custom Errors
  • Installing ASP.NET

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Setting Up Internet Information Services and ASP.NET - Installing ASP.NET


    (Page 5 of 5 )

     

    Once you’ve installed IIS, you can install ASP.NET. At the time of publication ASP.NET was available in two different packages:

    • The free .NET runtime. You can download the installation files fromhttp://www.asp.net, or you can order them on a CD athttp://microsoft.order-2.com/developertools.
    • The Visual Studio .NET application, which includes the .NET Framework and an IDE to design your applications.

    Like most Microsoft setup applications, the process is quite straightforward. A graphical wizard (shown in Figure 2-17) takes you through every step of the lengthy process.


    Figure 2-17.  The Visual Studio .NET setup

    After the setup is complete, you’ll find several new directories on your computer. These include the following, among others:

    • C:\[WinDir]\Microsoft.NET\[Version] contains the core .NET files. This includes the VB .NET, C#, JScript .NET, and J# language compilers, the ASP.NET service, and numerous utilities.
    • C:\[WinDir]\Assembly contains the higher-level functionality of .NET—namely, it’s where the shared .NET Framework assemblies are located. These assemblies contain all the types in .NET class library.
    • C:\[WinDir]\Microsoft.NET\[Version]\Config contains computer-specific configuration files, the most important of which is the machine.config file.
    • C:\[WinDir]\Microsoft.NET\[Version]\Temporary ASP.NET Files contains natively compiled ASP.NET web page code. The ASP.NET service uses this directory behind the scenes, compiling code and caching it for the best possible performance.
    • C:\Program Files\Microsoft Visual Studio .NET is the default location for the Visual Studio .NET software, if you’ve installed it. The directory name varies slightly depending on the version of Visual Studio .NET that you’ve installed.

    Note that [WinDir] represents your Windows directory (typically WINDOWS or WINNT), while [Version] represents the version of the .NET Framework that you’ve installed (such as v1.1.4322).

    Verifying that ASP.NET Is Correctly Installed

    After installing ASP.NET, it’s a good idea to test that it’s working. All you need to do is create a simple ASP.NET page, request it in a browser, and make sure that it’s processed successfully.

    To perform this test, create a text file in the c:\Inetpub\wwwroot directory. Name this file test.aspx. The filename isn’t that important, but the extension is. It’s the .aspx extension that tells IIS that this file needs to be processed by the ASP.NET engine.

    Inside the test.aspx file, paste the following code:

    <html>
    <body>
    <h1>The date is <% Response.Write(DateTime.Now.ToLongDateString()) %>
    </h1>
    </body>
    </html>

    When you request this file in a browser, ASP.NET will load the file, execute the embedded code statement (which retrieves the current date and inserts it into the page), and then return the final HTML page. This example isn’t a full-fledged ASP.NET web page, because it doesn’t use the web control model you’ll be exploring in the second part of this book. However, it’s still enough to test that ASP.NET is working properly. When you enter http://localhost/test.aspx in the browser, you should see a page that looks like the one shown in Figure 2-18.


    Figure 2-18.  ASP.NET is correctly installed

    If you see only the plain text, as in Figure 2-19, ASP.NET isn’t installed correctly. This problem commonly occurs if ASP.NET is installed but the ASP.NET file types aren’t registered in IIS. In this case, ASP.NET won’t actually process the request. Instead, the raw page will be sent directly to the user, and the browser will only display the content that isn’t inside a tag or script block.


    Figure 2-19.  ASP.NET isn't installed or configured correctly

    This problem can usually be solved by repairing your installation of ASP.NET using the original setup CD or DVD. To start this process, type in the following command at the command line (or in the Run window) using the Visual Studio .NET DVD. (It’s split into two lines due to page constraints, but it should be entered on a single line.)

    <DVD Drive>:\wcu\dotNetFramework\dotnetfx.exe
    /t:c:\temp
      /c:"msiexec.exe /fvecms c:\temp\netfx.msi"

    If you’re using the CD version of Visual Studio .NET, use the following command line with the Windows Component Update CD:

    <CD Drive>:\dotNetFramework\ dotnetfx.exe /t:c:\temp
      /c:"msiexec.exe /fvecms c:\temp\netfx.msi"

    Getting the Samples

    This book includes a wide range of code examples that are available online athttp://www.prosetech.com. These samples are downloadable as a single ZIP file, which you can extract onto your computer using a utility like WinZip. In order to run the files, you’ll need to place them into a virtual directory of your choice.

    Along with the sample files are the additional project and solution files that Visual Studio .NET creates automatically for web applications. In order to open these projects in Visual Studio .NET without any problem, you must use the exact same directory structure that I’ve used (which incorporates a C:\ASP.NET root directory). Generally, this directory structure will be created automatically when you unzip the file, but you’ll need to make sure you use the same drive (C:) to match what Visual Studio .NET expects. After you’ve unzipped all the code files, you’ll have to map the new directories to the appropriate virtual directories. This can be accomplished quite quickly if you follow the exact installation instructions described on the website or in the readme.txt file included with the code download.

    The ASP.NET Account

    When ASP.NET is installed, a new Windows user account is created called ASPNET. By default, the ASP.NET service runs under this account when it executes any ASP.NET code, including the code in your custom web pages and web services.

    The ASPNET account has a set of carefully limited privileges. By default, the ASPNET account won’t be allowed to perform tasks like reading the Windows registry, retrieving information from a database, or writing to most locations on the local hard drive. On the other hand, it will have the permissions that are essential for normal functioning. For example, the ASPNET account is allowed to access the Temporary ASP.NET Files directory, so that it can compile and cache web pages.

    The limited security settings of the ASPNET account are designed to prevent malicious code from damaging your web server. However, you’ll probably find that your applications require some additional permissions beyond those given to the ASPNET account. For example, your code might need to write data to a specific directory, use the Windows event log, and execute database operations. You can grant permissions to the ASPNET account in the same way that you would grant them to any other Windows user account. However, the process isn’t always obvious—so you might want to consult a good handbook about Windows system administration before you take these steps.

    If you’re using a computer for development testing only, you can use a shortcut to give the ASP.NET service greater privileges. Instead of using the ASPNET account, you can configure ASP.NET code so that it runs under the local system account. The local system account is a built-in Windows account with administrator-level permissions. Code that runs under this account has the ability to do almost anything on the current computer. Using the local system account is a poor idea on a production system, but it isn’t a bad approach for testing a new web application on a development computer.


    NOTE
    The ASP.NET account is a global setting that affects all web applications on the computer, provided you’re using IIS 5. If you’re using Windows Server 2003, you must use configure the IIS 6 application pool settings instead. Editing the machine.config will have no effect.

    To change the ASP.NET settings to use the local system account, you need to perform the following steps.

    1. Open the machine.config file in the C:\[WinDir]\Microsoft.NET\[Version]\ Config directory using Notepad. (If you’ve installed the .NET Framework 1.1 on a Windows XP computer, this directory will be C:\Windows\Microsoft.NET\ v1.1.4322\Config.
    2. Search for the text userName="Machine". You’ll find this setting in the processModel tag, which looks something like this:

      <processModel enable="true" ... userName="Machine" password="AutoGenerate" ... /> 
    3. The userName="Machine" instruction tells ASP.NET to run using the special ASPNET account. Modify this attribute to be userName="System". This tells ASP.NET to use the local system account.

      <processModel enable="true" ... userName="System" password="AutoGenerate" ... /> 
    4. Now you must restart the ASP.NET service. To do this, you can either reboot the computer, or you can use Task Manager to manually terminate the ASP.NET service. In the latter case, look for the process named aspnet_wp.exe. Select it and click End Process.

    The effect of the ASP.NET account is explored in Chapter 25, which tackles security in more depth.


    NOTE  
    You might wonder how virtual directory permissions and the ASP.NET account settings interact. Essentially, the virtual directory permissions determine what files a user can request. If the user successfully requests an ASP.NET file, the ASP.NET engine will then execute the corresponding web page code. The ASP.NET account settings determine what this code is allowed to do.
    The Last Word

    In this chapter, you learned how to make sure your computer is ready to host ASP.NET websites. Before you continue to the next part, make sure you’ve verified that you can request the sample ASP.NET page (as described in the section “Verifying that ASP.NET Is Correctly Installed”). This ensures that both ASP.NET and IIS are installed and configured properly. Once that’s in place, you’re ready to begin designing full-fledged ASP.NET applications and web pages. You can start with Chapter 3, which presents a comprehensive overview of the new Visual Basic .NET language.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This article is an excerpt from the book "The Definitive Guide to SAMBA 3",...
     

    Buy this book now. This article is excerpted from chapter two of the book The Definitive Guide to SAMBA 3, written by Roderick Smith (Apress, 2004; ISBN: 1590592778). Check it out at your favorite bookstore today. Buy this book now.

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek