COM+ IntegrationThe Windows Communication Foundation provides a rich environment for creating distributed applications. If you have a substantial investment in component-based application logic hosted in COM+, you can use WCF to extend your existing logic rather than having to rewrite it. A common scenario is when you want to expose existing COM+ or Enterprise Services business logic through Web services. When an interface on a COM+ component is exposed as a Web service, the specification and contract of those services are determined by an automatic mapping to be performed at application initialization time. The conceptual model for this mapping is as follows:
Note The contracts for the generated WCF services are tied to the underlying COM+ application's interfaces and configuration. Modifying the COM+ component methods automatically results in an updated service when the application is next started. However, a modification to the number of interfaces does not automatically update the available services. In the latter scenario you will need to rerun the COM+ Service Model Configuration tool (ComSvcConfig.exe). The authentication and authorization requirements of the COM+ application and its components continue to be enforced when used as a Web service. If the caller initiates a Web service transaction, components marked as transactional enlist within that transaction scope. The steps that are required to expose a COM+ component's interface as a Web service without modifying the component are as listed here:
Supported InterfacesThere are some restrictions on the type of interfaces that can be exposed as a Web service. Here's the list of restricted interface types:
Selecting the Hosting ModeAs is stated in the documentation, COM+ can expose Web services in one of the following three hosting modes. COM+-HostedThe Web service is hosted within the application's dedicated COM+ server process (Dllhost.exe). This mode requires the application to be explicitly started before it can receive Web service requests. The COM+ options Run as an NT Service or Leave Running When Idle can be used to prevent idle shutdown of the application and its services. This mode has the benefit that it provides both Web service and DCOM access to the server application. Web-HostedThe Web service is hosted within a Web server worker process. This mode does not require the COM+ application to be active when the initial request is received. If the application is not active when this request is received, it is automatically activated before the request is processed. This mode also provides both Web service and DCOM access to the server application, but it incurs a process hop for Web service requests. This typically requires the client to enable impersonation. In WCF, this can be done with the SetSspiSettings method and the Impersonation enumeration value. Note Like other WCF services, the security settings for the exposed service are administered through roles and web host settings. COM+ application roles are enforced, whereas traditional DCOM security settings such as the DCOM machine-wide permissions settings are not. Web-Hosted In-ProcessThe Web service and the COM+ application logic are hosted within the Web server worker process. This provides automatic activation of the web hosted mode, without incurring the process hop for Web service requests. The disadvantage is that the server application cannot be accessed through DCOM. |