Share via


ComContractElement.ExposedMethods 屬性

定義

取得 COM+ 方法的集合,這些方法會在 COM+ 元件上的介面公開為 Web 服務時公開。

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

屬性值

ComMethodElementCollection

COM+ 方法的集合,這些方法會在 COM+ 元件上的介面公開為 Web 服務時公開。

屬性

備註

COM+ 整合設定工具 (ComSvcConfig.exe) 可用來從 COM 介面加入特定的方法,使這些方法可以出現在所產生的服務合約上。

例如,您可以使用下列命令,從 IFinances 元件上的 ItemOrders.Financial COM 介面將三個具名方法新增至所產生的服務合約中。

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 項目清單中的方法,嘗試產生服務合約。 這時會針對每個未包含在服務合約中的介面方法加以追蹤。

適用於