Benefits of Precompilation in ASP.NET:
- Initial response of application will be faster for users, because code and files will not have to be compiled at the first time any user requested.
- We can ensure error free application at compile time
- From security concern people who have access to production server cannot see the source code and cannot make the changes(if you have chose the option of not updatable at the time of publish).
- Large websites must use this precompilation.
How to enable precompilation for deployment :
- In Visual Studio, open a web application project.
- Right click the project name in Solution Explorer, and then choose Publish.
- Select the Settings tab and check precopile during publishing.
- Click Configure for advanced setting of precompilation.
This Precompilation have some advanced properties also : Click on configure for advanced proprieties of precompilation.
I do always prefer my application to choose "Allow precompiled site to be updatable" because its allows to me update my (.aspx, .cshtml, .ascx , partial views, master files) in application.
its very useful when you have to update your website for minor changes ,and you don't want to deploy a build again.
References and further readings:ASP.NET Precompilation Overview
ASP.NET Web Application Project Precompilation Overview
Advanced Precompile Settings
For more ASP.NET applications Performance tips and tricks