<PreferComInsteadOfManagedRemoting > 元素<PreferComInsteadOfManagedRemoting> Element

指定运行时是否将对跨应用程序域边界的所有调用使用 COM 互操作而不是远程处理。Specifies whether the runtime will use COM interop instead of remoting for all calls across application domain boundaries.

<configuration> <configuration>
   <运行时 >   <runtime>
     <PreferComInsteadOfManagedRemoting >    <PreferComInsteadOfManagedRemoting>

语法Syntax

<PreferComInsteadOfManagedRemoting enabled="true|false"/>  

属性和元素Attributes and Elements

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

AttributesAttributes

属性Attribute 说明Description
enabled 必需的特性。Required attribute.

指示运行时是否将使用 COM 互操作,而不是跨应用程序域边界进行远程处理。Indicates whether the runtime will use COM interop instead of remoting across application domain boundaries.

enabled 特性enabled Attribute

Value 说明Description
false 运行时将跨应用程序域边界使用远程处理。The runtime will use remoting across application domain boundaries. 这是默认设置。This is the default.
true 运行时将跨应用程序域边界使用 COM 互操作。The runtime will use COM interop across application domain boundaries.

子元素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

enabled 特性设置为 true时,运行时的行为如下所示:When you set the enabled attribute to true, the runtime behaves as follows:

这两个行为确保跨应用程序域边界在托管对象之间对 COM 接口进行的所有调用均使用 COM 和 COM 互操作,而不是远程处理。These two behaviors ensure that all calls over COM interfaces between managed objects across application domain boundaries use COM and COM interop instead of remoting.

示例Example

下面的示例演示如何指定运行时应跨隔离边界使用 COM 互操作:The following example shows how to specify that the runtime should use COM interop across isolation boundaries:

<configuration>  
  <runtime>  
    <PreferComInsteadOfManagedRemoting enabled="true"/>  
  </runtime>  
</configuration>  

另请参阅See also