Export (0) Print
Expand All
4 out of 6 rated this helpful - Rate this topic

How to: Precompile ASP.NET Web Site Projects

Precompiling an ASP.NET Web site project provides faster initial response time for users since pages do not have to be compiled the first time they are requested. This is particularly useful for large Web sites that are updated frequently.

The procedure in this topic uses the switches and parameters of the ASP.NET Compilation Tool (Aspnet_compiler.exe). For more information about this tool, see ASP.NET Compilation Tool (Aspnet_compiler.exe).

For more information about precompilation, see ASP.NET Precompilation Overview

NoteNote

This topic does not apply to Web application projects. For information about the difference between Web site projects and Web application projects, see Web Application Projects versus Web Site Projects.

To precompile an ASP.NET Web site in place

  1. Open a command window and navigate to the folder containing the .NET Framework.

    The .NET Framework is installed in the following location.

    %windir%\Microsoft.NET\Framework\version
    
  2. Run the aspnet_compiler command by typing the following at a command prompt.

    aspnet_compiler -v /virtualPath
    

    The virtualPath parameter indicates the Internet Information Services (IIS) virtual path of your Web site.

    If your Web site is not an IIS application, and therefore has no entry in the IIS metabase, type the following command at a command prompt.

    aspnet_compiler -p physicalOrRelativePath -v /
    

    In this case, the physicalOrRelativePath parameter refers to the fully qualified directory path in which the Web site files are located, or a path relative to the current directory. The period (.) operator is allowed in the physicalOrRelativePath parameter. The -v switch specifies a root that the compiler will use to resolve application-root references (for example, with the tilde (~) operator). When you specify the value / for the -v switch, the compiler will resolve the paths by using the physical path as the root.

Community Additions

Show:
© 2014 Microsoft. All rights reserved.