How to: Use the COM+ Service Model Configuration Tool
Once you have selected an appropriate hosting mode, use the COM+ Service Model Configuration command-line tool (ComSvcConfig.exe) to configure the application interfaces that will be exposed as Web services.
Note
You must be an administrator on the machine to perform any of the following tasks.
To add an interface to the set of interfaces that are to be exposed as Web services, using the COM+ hosting mode
Run ComSvcConfig using the /install and /hosting:complus options, as shown in the following example.
ComSvcConfig.exe /install /application:OnlineStore /contract:ItemOrders.Financial,IFinances /hosting:complus /verbose
The command adds the
IFinances
interface of theItemOrders.IFinancial
component (from the OnlineStore COM+ application) to the set of interfaces that will be exposed as Web services. The service uses the COM+ hosting mode and therefore requires explicit application activation.While the wildcard asterisk (*) character can be used for the component and the interface, avoid using it because you might want to expose only selected functionality as a Web service. If run with a future version of this component, using the wildcard may unintentionally expose interfaces that may not have been present when the configuration syntax was determined.
The /verbose option instructs the tool to display warnings in addition to any errors.
The contract for the exposed service will contain all of the methods from the
IFinances
interface.
To add only specific methods from an interface to the set of interfaces that are to be exposed as Web services, using the COM+ hosting mode
Run ComSvcConfig using the /install and /hosting:complus options with explicit naming of the required methods, as shown in the following example.
ComSvcConfig.exe /install /application:OnlineStore /contract:ItemOrders.Financial,IFinances.{Credit,Debit} /hosting:complus /verbose
The command adds only the
Credit
andDebit
methods from theIFinances
interface as operations to the exposed service contract. All other methods on the interface will be omitted from the contract and will not be callable from Web service clients.
To add an interface to the set of interfaces that are to be exposed as Web services, using the Web hosting mode
Run ComSvcConfig using the /install option and the /hosting:was option, as shown in the following example.
ComSvcConfig.exe /install /application:OnlineWarehouse /contract:ItemInventory.Warehouse,IStockLevels /hosting:was /webDirectory:root/OnlineWarehouse /mex /verbose
The command adds the
IStockLevels
interface on theItemInventory.Warehouse
component (from the OnlineWarehouse COM+ application) to the set of interfaces that will be exposed as Web services. The service is Web hosted in the OnlineWarehouse virtual directory of IIS rather than in COM+, and thus the application is automatically activated as required.To use the Web-hosted in-process configuration, the COM+ application must be configured to run as a Library application rather than a Server application using the Component Services administration console. Applications configured as Server applications use the standard Web-hosted mode and incur a process hop to process each request.
The /mex option adds an additional Metadata Exchange (MEX) service endpoint that uses the same transport as the application's service endpoint to support clients that want to retrieve a contract definition from the service.
To remove a Web service for a specified interface
Run ComSvcConfig using the /uninstall option, as shown in the following example.
ComSvcConfig.exe /uninstall /application:OnlineStore /contract:ItemOrders.Financial,IFinances /hosting:complus
The command removes the
IFinances
interface on theItemOrders.Financial
component (from the OnlineStore COM+ application).
To list currently exposed interfaces
Run ComSvcConfig using the /list option, as shown in the following example.
ComSvcConfig.exe /list
The command lists the currently exposed interfaces, along with the corresponding address and binding details, scoped to the local machine.
To list specific currently exposed interfaces
Run ComSvcConfig using the /list option, as shown in the following example.
ComSvcConfig.exe /list /application:OnlineStore /hosting:complus
The command lists currently exposed COM+-hosted interfaces, along with the corresponding address and binding details, for the OnlineStore COM+ application on the local machine.
To display help on the options that can be used with the utility
Run ComSvcConfig using the /? option, as shown in the following example.
ComSvcConfig.exe /?