ASP.NET预编译的优点是什么?
使用 Aspnet_compiler.exe 代替通过 Visual Studio 进行的传统发布有多有用?那么资源 (resx) 文件又如何呢?
How useful is it to use Aspnet_compiler.exe instead of conventional Publish via Visual Studio? And what about resource (resx) files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
与简单的 xcopy 相比,预编译具有两个主要优点:
文件系统不会包含
.aspx
文件中的所有代码,并且所有后面的代码都会编译到程序集中。服务器启动后首次访问页面时不会出现 ASP.NET 编译延迟。
话说回来,这几天我的预编译知识有点生疏了,上次接触已经是前段时间了。
Precompilation, as opposed to simple xcopy gives you two main advantages:
The filesystem will not have all the code in
.aspx
files and all the code behind is compiled into an assembly.There is no ASP.NET compilation delay the first time you visit a page after the server starts up.
Having said that, my precompilation knowledge is a bit rusty these days, last time I touched it was a while back.
通过预编译站点,您的服务器不必在第一次访问时编译站点。您可能已经注意到,第一次查看 ASP.NET 页面时会出现明显的延迟。
此外,您不必发送所有文件,因为代码已经编译。如果您不信任托管您页面的人,这可能会很有用。
By pre compiling the site your server won't have to compile the site on the first visit. You have probably noticed that the first time you view an asp.net page there is a noticeable delay.
In addition you don't have to ship all your files since the code is already compiled. This can be useful if you don't trust whoever is hosting your pages.
Visual Studio 的“发布”功能实际上只是 aspnet_compiler.exe 的一个很好的前端。发布的优点是非常容易执行,其中 aspnet_compiler.exe 需要进行一些调整才能获得您想要的结果。
Visual Studio's "Publish" feature is actually just a nice frontend to aspnet_compiler.exe. Publish has the advantage of being very easy to execute, where aspnet_compiler.exe requires some tweaking to get the results you're after.