简体   繁体   中英

Whats the advantage of pre-compiling ASP.NET project using aspnet_compiler.exe?

Whats the advantage of pre-compiling an ASP.NET project using aspnet_compiler.exe?

Also, is there a possibility that a the compiled project will have errors after it is being deployed to a remote server? There is an issue raised by the team that maybe if the machine where the project is compiled and the server where the project will be deployed will have different settings, the project will not run or run erroneously. Has anybody encountered this situation?

I see two principle reasons:

  1. Compile time error checking.
  2. Avoiding overhead of compile on first page fit.

The first of these allows more errors to be detected while in development (eg typo in property name) rather than getting the yellow screen of death. If the code in question is an error path, it can be hard to ensure test coverage so things can slip through.

This cannot guarantee that there will be no errors in production. Clearly logic errors will not be found at compile time, nor will missing error handling (to name but two huge categories of bugs).

Also it will not prevent missing reference problems due to a missing assembly (present on the development machine but not deployed to production). Thus good practice is still to have a staging environment (this could also be for acceptance testing) which is treated by developers and testers as if it were production --- only access is to deploy a corrected version (no direct fixing) so fixes all start in development (and source control).

Another advantage is protecting your source code if you have to deploy to an untrusted environment (eg shared hosting), as you only deploy binaries which make it much harder for a third party to do any reverse-engineering than if you have all your .cs files up there.

You won't see any cross-platform issues just from performing the compilation. Check out this answer which explains how .NET runs on different architectures.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM