<disableCachingBindingFailures > 元素<disableCachingBindingFailures> Element

指定是否禁用缓存绑定故障的原因是通过探测找不到程序集。Specifies whether to disable the caching of binding failures that occur because the assembly was not found by probing.

<配置 > 元素<configuration> Element
<运行时 > 元素<runtime> Element
<disableCachingBindingFailures><disableCachingBindingFailures>

语法Syntax

<disableCachingBindingFailures enabled="0|1"/>  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
enabledenabled 必需的特性。Required attribute.

指定是否禁用缓存绑定故障的原因是通过探测找不到程序集。Specifies whether to disable the caching of binding failures that occur because the assembly was not found by probing.

enabled 特性enabled Attribute

Value DescriptionDescription
00 不要禁用绑定失败的原因是通过探测找不到程序集缓存。Do not disable the caching of binding failures that occur because the assembly was not found by probing. 这是从.NET Framework 2.0 版的默认绑定行为。This is the default binding behavior starting with the .NET Framework version 2.0.
11 禁用的绑定失败的原因是通过探测找不到程序集缓存。Disable the caching of binding failures that occur because the assembly was not found by probing. 此设置将恢复为.NET Framework 1.1 版的绑定行为。This setting reverts to the binding behavior of the .NET Framework version 1.1.

子元素Child Elements

无。None.

父元素Parent Elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关程序集绑定和垃圾回收的信息。Contains information about assembly binding and garbage collection.

备注Remarks

从.NET Framework 2.0 版开始,加载程序集的默认行为是缓存所有绑定和加载失败。Starting with the .NET Framework version 2.0, the default behavior for loading assemblies is to cache all binding and loading failures. 即,如果尝试加载程序集失败,后续请求同一程序集加载立即失败,而无需任何尝试查找程序集。That is, if an attempt to load an assembly fails, subsequent requests to load the same assembly fail immediately, without any attempt to locate the assembly. 此元素将禁用绑定失败的原因是探测路径中找不到程序集的默认行为。This element disables that default behavior for binding failures that occur because the assembly could not be found in the probing path. 这些失败引发FileNotFoundExceptionThese failures throw FileNotFoundException.

一些绑定和加载失败不受此元素,并始终进行缓存。Some binding and loading failures are not affected by this element, and are always cached. 这些失败原因是该程序集已找到,但无法加载。These failures occur because the assembly was found but could not be loaded. 它们将引发BadImageFormatExceptionFileLoadExceptionThey throw BadImageFormatException or FileLoadException. 以下列表包含此类故障的一些示例。The following list includes some examples of such failures.

  • 如果你尝试加载文件不是有效的程序集,即使错误的文件将被替换为正确的程序集加载程序集的后续尝试将失败。If you attempt to load a file is not a valid assembly, subsequent attempts to load the assembly will fail even if the bad file is replaced with the correct assembly.

  • 如果尝试加载已锁定的文件系统程序集,加载程序集的后续尝试将失败,即使文件系统发布程序集。If you attempt to load an assembly that is locked by the file system, subsequent attempts to load the assembly will fail even after the assembly is released by the file system.

  • 如果尝试加载的程序集的一个或多个版本位于探测路径中,但在它们之间的不是你请求的特定版本,加载该版本的后续尝试将失败,即使正确的版本将移到探测路径。If one or more versions of the assembly that you are attempting to load is in the probing path, but the specific version you are requesting is not among them, subsequent attempts to load that version will fail even if the correct version is moved into the probing path.

示例Example

下面的示例演示如何禁用的原因是通过探测找不到程序集的程序集绑定故障缓存。The following example shows how to disable the caching of assembly binding failures that occur because the assembly was not found by probing.

<configuration>  
   <runtime>  
      <disableCachingBindingFailures enabled="1" />  
   </runtime>  
</configuration>  

请参阅See also