mardi 14 novembre 2006

Precompilation for deployment ASP.NET 2.0

From: http://www.developer.com/net/asp/article.php/10917_3450901_2
Precompilation for deployment

Precompilation for deployment enables you to create an executable version of your entire Web site that can be deployed without any source code, including HTML and other static files. By using this mode of precompilation, you can prevent easy access to the intellectual property your code represents. The resulting set of assemblies and stub files can be deployed to a production server through XCOPY, FTP, Windows Explorer, and so forth.

ASP.NET 2.0 provides a command-line utility called aspnet_compiler.exe that allows you to not only precompile but also deploy the Web site in a single step (see Figure 6). To invoke the ASP.NET precompiler, open the Visual Studio 2005 command prompt and enter the following command:

aspnet_compiler -v /[websitename] -p [source] [destination]

Where [websitename] is the name of the Web site, and [source] and [destination] are file system paths pointing to the location of the source Web site and the location to which the compiled version should be emitted. For the example Web site, the command would look something like the following:

aspnet_compiler -v /Deployment -p c:\inetpub\wwwroot\myprojects\Developer\deployment c:\compiled

To view all of the available options for the ASP.NET precompiler, simply enter the command aspnet_compiler /? in the command prompt. After precompiling the Web site for deployment, navigate to the destination directory in Windows Explorer. You'll see a Web site with a bin directory containing several assemblies and descriptive files, as well as a number of stub files with the same names as the original pages, but with the code (both HTML and executable code) stripped out. However, if you browse the site, the output will be identical to the original site.

Precompilation using Visual Studio 2005

You also can use Visual Studio 2005 to precompile the Web site and deploy it in a specific location. To accomplish this, select Website->Publish Web Site from the menu, which will result in the dialog box displayed in Figure 7.

Clicking on Browse will display the Publish Web dialog box. In the Publish Web Site dialog box, you can choose to deploy the Web site in a file system, local IIS, FTP site, or remote site. If you click OK in the above dialog box, Visual Studio will copy all the required files to the C:\PrecompiledWeb directory and you can browse to this directory as any other Web directory.

Aucun commentaire:

Publier un commentaire