RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Eight Key Practices for ASP.NET Deployment : Page 3

Discover some best practices for deploying ASP.NET applications as well as a few useful procedures that you can follow to improve your application's performance.

5. Deploy with an Appropriate Strategy (continued)
Deploying with XCOPY
Deploying an ASP.NET application in the production server is simple: Just use the XCOPY command to copy your application's entire folder structure to the production environment. Here's the XCOPY procedure:

  1. Open a console window by clicking on Start → Run
  2. Type cmd and press enter
  3. Create the same folder structure at the target location where you would copy your web site.
  4. Finally, type the following command at the command prompt, using your path information (see Figure 10).
   XCOPY DevX\SharedWebSite DevX\SourceWebSite /e /r /k /h /i /y 
Figure 10. XCOPY Example: The XCOPY command using the options shown in the figure copies all directories, subdirectories, and files to the shared web site.

Author's Note: When you use XCOPY from Microsoft's Vista OS, you'll see a message reading: "XCOPY is now deprecated; please use ROBOCOPY." ROBOCOPY stands for "Robust File Copy." In Vista, you can find more information by typing ROBOCOPY /? at a command line.

The preceding command copies the SharedWebsite folder and its subdirectories to the c:\DevX\SourceWebSite folder on the production system. Here's an explanation of the specified options:

  • /e: Copy all directories and subdirectories, including empty ones
  • /r: Overwrite existing read-only files
  • /h: Copy system and hidden files and directories
  • /k: Copy file and directory attributes
  • /y: Suppresses "overwrite existing file" confirmation messages
You can easily deploy one or more files from the command prompt using the XCOPY command. To deploy a single file, use a command such as this:

   XCopy E:\MyApp\MyAppAssembly.dll C:\InetPub\wwwroot\bin
To deploy all DLL files, you could use this command:

   Xcopy E:\MyApp\*.dll C:\InetPub\wwwroot\bin
XCOPY vs. the Copy Web Site Tool
Now that you've seen both methods, which should you use? Using the Copy Web Site Tool has one major disadvantage compared to XCOPY deployment—the initial load time of your web pages is slower. That's because The Copy Web Site Tool copies all your source pages as source, and the Copy Web Site technique performs no compilation. In addition, copying the source files injects a potential risk to your intellectual property, because people can see the source. However, Copy Web Site improves on XCOPY because you can use it to deploy your application to a file system, a local instance of Internet Information Server (IIS), FTP sites, or even to remote sites seamlessly.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date