編輯

共用方式為


ComContractElement.ExposedMethods Property

Definition

Gets a collection of COM+ methods that are exposed when the interface on a COM+ component is exposed as a Web service.

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

Property Value

The collection of COM+ methods that are exposed when the interface on a COM+ component is exposed as a Web service.

Attributes

Remarks

The COM+ integration configuration tool (ComSvcConfig.exe) can be used to add specific methods from a COM interface to appear on the generated service contract.

For example, you can use the following command to add the three named methods from the IFinances COM interface on the ItemOrders.Financial component, to the generated service contract.

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

When you run the ComSvcConfig.exe tool, it then generates the following service contract listing the previously mentioned methods as exposedMethod elements.

<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>

At service initialization time, the runtime attempts to generate a service contract by reflecting over and adding only the methods included in the list of exposedMethod elements. A trace is produced for every interface method that is not included on the service contract.

Applies to