ComContractElement.ExposedMethods 属性

定义

获取 COM+ 组件上的接口作为 Web 服务公开时公开的 COM+ 方法的集合。

public:
 property System::ServiceModel::Configuration::ComMethodElementCollection ^ ExposedMethods { System::ServiceModel::Configuration::ComMethodElementCollection ^ get(); };
[System.Configuration.ConfigurationProperty("exposedMethods", Options=System.Configuration.ConfigurationPropertyOptions.None)]
public System.ServiceModel.Configuration.ComMethodElementCollection ExposedMethods { get; }
[<System.Configuration.ConfigurationProperty("exposedMethods", Options=System.Configuration.ConfigurationPropertyOptions.None)>]
member this.ExposedMethods : System.ServiceModel.Configuration.ComMethodElementCollection
Public ReadOnly Property ExposedMethods As ComMethodElementCollection

属性值

COM+ 组件上的接口作为 Web 服务公开时公开的 COM+ 方法的集合。

属性

注解

COM+ 集成配置工具(ComSvcConfig.exe)可用于从 COM 接口添加特定方法,以显示在生成的服务协定上。

例如,可以使用以下命令将组件上的 COM 接口中的IFinancesItemOrders.Financial三个命名方法添加到生成的服务协定。

ComSvcConfig.exe /i /application:OnlineStore /contract:ItemOrders.Financial,IFinances.{TransferFunds,AddFunds,RemoveFunds} /hosting:complus  

运行 ComSvcConfig.exe 工具时,它会生成以下服务协定,其中列出了前面提到的方法作为 exposedMethod 元素。

<comContracts>
  <comContract contract="{5163B1E7-F0CF-4B6A-9A02-4AB654F34284}"                     												   																						   
  namespace="http://tempuri.org/5163B1E7-F0CF-4B6A-9A02-4AB654F34284"													   																						   
  name="_Broker" requiresSession="true">
    <userDefinedTypes>
      <userDefinedType name="CustomerType"																	   																						   
         typeLibID="{91DC728C-4F1A-45de-A9B6-B538E209CEA6}"															   																						   
         typeLibVersion="1.0"																		   																						   
         typeDefID="{D129765C-F211-434e-825A-9A63198C41F2}" />          
      <userDefinedType name="AddressType"																	   																						   
         typeLibID="{91DC728C-4F1A-45de-A9B6-B538E209CEA6}"															   																						   
         typeLibVersion="1.0"																		   																						   
         typeDefID="{4616AE0D-687A-43B7-BC63-141AE3DFD099}" />          
    </userDefinedTypes>
    <exposedMethods>
      <add exposedMethod ="BuyStock" />
      <add exposedMethod ="SellStock" />
      <add exposedMethod ="ExecuteTransaction" />
    </exposedMethods>
  </comContract>
</comContracts>

在服务初始化时,运行时会尝试通过反映并仅添加元素列表中 exposedMethod 包含的方法来生成服务协定。 为服务协定中不包含的每个接口方法生成跟踪。

适用于