<编译调试=“true”> 在预编译的 asp.net 网站中 - 这重要吗?

发布于 2024-07-17 12:23:55 字数 237 浏览 7 评论 0 原文

我正在 Visual Studio 2008 上使用 Web 部署项目部署一个预编译和全页面合并的网站。请注意,所有程序集和项目都已在发布模式下编译。

我的所有页面都是在发布模式下预编译的。 所以它们不会被重新编译,它们只会被运行时加载。 在这种情况下,当不需要页面编译时,在 system.web 中设置 会有什么不同吗?

I'm deploying a precompiled and all-page-merged website using Web Deployment Projects on Visual Studio 2008. Note that all assemblies and projects have been compiled in Release mode.

All my pages are pre-compiled in release mode. So they wont be recompiled, they'll just be loaded by runtime. In that case when the page compilation is not required, Setting <compilation debug="true"> in system.web will make any difference ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

君勿笑 2024-07-24 12:23:55

查看下面的优秀链接:

基本上:

  • 由于调试支持的开销,您的代码将运行得更慢。
  • 脚本和图像不会缓存在客户端,因为如果您不断进行更改和调试,您不希望在开发过程中缓存内容。
  • 请求不会超时。 同样,当您调试代码时,您不希望出现请求超时。

上述情况均不可取。 您会在上面的链接中发现更多缺点。

Check out the excellent links below:

Basically:

  • Your code will run slower because of the overhead of debugging support.
  • Scripts and images are not cached on the client side because you don't want things to be cached in development if you're constantly making changes and debugging.
  • Requests are not timed out. Again when you're debugging your code, you don't want to get a request timeout.

None of the above is desirable. You will find more disadvantages in the above links.

清君侧 2024-07-24 12:23:55

根据文档

指定是否编译调试二进制文件而不是零售二进制文件

但是,刚刚通过 System.Web 快速反映,我可以看到调试标志由以下内容(直接或间接)使用:

  • 运行时编译 (ASPX/ASCX/MASTER)
  • 的代码生成浏览器功能文件
  • HttpDebugHandler,在调试会话期间使用。

因此,如果您的站点经过预编译,您将不会受到性能影响。 然而,由于 HttpApplication 将响应 DEBUG http 动词,因此您将面临安全问题。

简而言之,设置 debug=false,即使您的站点是预编译的。

编辑: debug=true 将导致缓存性能(参见 Mehmet Aras 的答案)命中并且没有执行超时,但它不会降低已编译页面的执行速度。

According to the documentation:

Specifies whether to compile debug binaries rather than retail binaries

However, having just quickly reflected through System.Web, I can see the debug flag is used (directly or indirectly) by the following:

  • Runtime compilation (ASPX/ASCX/MASTER)
  • Code generation of the browser capabilities files
  • HttpDebugHandler, which is used during a debugging session

As a result, if your site is precompiled you will not receive a performance hit. However, as the HttpApplication will respond to the DEBUG http verb, you open yourself up to security problems.

In short, set debug=false, even if your site is precompiled.

Edit: debug=true will result in a performance (see Mehmet Aras's answer) hit for caching and no execution timeout, but it will not reduce execution speed for compiled pages.

暮凉 2024-07-24 12:23:55

来自博客文章 ASP.Net – 再也不会了害怕使用 debug=true 发布您的网站:

  • ASP.NET 页面的编译需要更长的时间(因为批量编译已关闭)
  • 代码通常执行速度较慢
  • 内存占用增加
  • 从 WebResources.axd 处理程序下载的脚本和图像不会增加缓存的
  • 请求不会超时(这很糟糕,因为在生产环境中,我们不希望请求无限期地卡住)

本文继续建议设置生产服务器 machine.config 以确保强制零售部署模式,这本质上意味着调试总是假的。

From the blog post ASP.Net – Never again fear publishing your website with debug=true:

  • The compilation of ASP.NET pages takes longer (as batch compilation is turned off)
  • Code typically executes slower
  • Memory footprint is increased
  • Scripts and images downloaded from the WebResources.axd handler are not cached
  • Requests do not time out (this is bad, as in a production environment we dont want requests to be stuck indefinitely)

The article goes on to recommend setting the production server machine.config to ensure retail deployment mode is forced which essentially means debug is always false.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文