开发者

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 deploye开发者_如何学编程d 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 (e.g. 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 (e.g. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜