C# web.config批处理=“假”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/667653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
web.config batch="false"
提问by Danny G
What is the purpose of adding the batch="false" in the compilation tag in ASP.NET 1.1?
在 ASP.NET 1.1 的编译标记中添加 batch="false" 的目的是什么?
采纳答案by Brandon
MSDN says the purpose of the batch flag
MSDN说批处理标志的用途
eliminates the delay caused by the compilation required when you access a file for the first time. When this attribute is set to True, ASP.NET precompiles all the uncompiled files in a batch mode, which causes an even longer delay the first time the files are compiled. However, after this initial delay, the compilation delay is eliminated on subsequent access of the file.
消除了首次访问文件时所需的编译造成的延迟。当此属性设置为 True 时,ASP.NET 以批处理模式预编译所有未编译的文件,这会导致首次编译文件时的延迟更长。然而,在这个初始延迟之后,编译延迟在文件的后续访问中被消除。
Having it set to false will probably make it compile faster the first time, but slower subsequent times, and I believe this applies to 1.1 as well.
将它设置为 false 可能会使其第一次编译速度更快,但随后会更慢,我相信这也适用于 1.1。
回答by Walden Leverich
I believe the default is false (is in 2.0+) so the point of adding batch=false
would be as a documentation of the default, or as a placeholder so it's obvious what to change if you want true.
我相信默认值是假的(在 2.0+ 中)所以添加的重点batch=false
是作为默认值的文档,或者作为占位符,所以如果你想要真的话,很明显要改变什么。
回答by jdecuyper
In asp.net 1.1, when you compile in "batch mode" set to true, the output of the source files is compiled into single assemblies according to the directories, the type of file, etc. When "batch mode" is turned off, the output is a single assembly for the entire project.
Some of the advantages and disadvantages are described in this small paragraph from an MSDN article.
在 asp.net 1.1 中,当您在“批处理模式”设置为 true 下编译时,根据目录、文件类型等将源文件的输出编译为单个程序集。当“批处理模式”关闭时,输出是整个项目的单个程序集。
在MSDN 文章的这个小段落中描述了一些优点和缺点。
There are several issues you should be aware of when using this attribute.
- Performance—when Batch=false, the ASP.NET compiler will create an assembly for every Web form and user control in your Web application. It also causes the compiler to do a full compile, not an incremental compile, in Visual Studio 2005 when you build using F5. The net result is your Web application may run slower when deployed, and your build times will increase significantly in Visual Studio 2005.
- Assembly References—the Batch attribute may hide potential broken assembly references (when Batch=True), or even introduce a Circular Reference (when Batch=False).
使用此属性时,您应该注意几个问题。
- 性能—当 Batch=false 时,ASP.NET 编译器将为 Web 应用程序中的每个 Web 窗体和用户控件创建一个程序集。当您使用 F5 构建时,它还导致编译器在 Visual Studio 2005 中执行完整编译,而不是增量编译。最终结果是您的 Web 应用程序在部署时可能会运行得更慢,并且您的构建时间将在 Visual Studio 2005 中显着增加。
- 程序集引用——Batch 属性可能隐藏潜在损坏的程序集引用(当 Batch=True 时),甚至引入循环引用(当 Batch=False 时)。
回答by Iron Lung
I know this question is closed (and about v1.1) but the batch attribute is actually defaulted to True in .Net 2.0 onwards.
我知道这个问题已经结束(关于 v1.1),但批处理属性实际上在 .Net 2.0 中默认为 True 。
http://msdn.microsoft.com/en-us/library/s10awwz0%28VS.80%29.aspx
http://msdn.microsoft.com/en-us/library/s10awwz0%28VS.80%29.aspx