by Keyvan Nayyeri via Keyvan Nayyeri on 5/28/2007 4:44:23 PM
Running a WCF service from a COM+ component is one of main aspects of integration between WCF and other technologies. Building a WCF service based on a COM+ component is a straightforward task.
There are a few steps to follow in order to get this done. First you need to create a COM+ component and implement your code logic from an interface. Then register your COM+ component in GAC and create a web directory for it. And finally use ComSvcConfig command to generate client proxy class and configuration files.
Here I create a simple COM+ component based on IMyService interface and implement this interface in MyComponent class. After this I build this COM+ component and register it using RegSvcs command. I described all steps to build and register such a component in one of my article posts about atomic transaction in .NET.
using System;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;
namespace ComComponent
{
public interface IMyService
string MyMethod(string name);
}
[assembly: ApplicationAccessControl(true)]
[Transaction(TransactionOption.RequiresNew)]
public class MyComponent : ServicedComponent, IMyService
#region IMyService Members
public string MyMethod(string name)
return (string.Format("Hello {0}!", name));
#endregion
After this, I go to IIS and create a web directory for my service and name it ComComponent. Once this is done, I can use ComSvcConfig tool from command line to create my sevice and make it accessible via IIS. For more information about this command tool, you can check an article on MSDN. In a nutshell, it gets some parameters such as COM+ class and interface name and web directory name to install the COM+ as a service.
comsvcconfig install /application:ComComponent /interface:ComComponent.Mycomponent,IMyService /hosting:was webdirectory:comcomponent /mex
At this point, I should be able to get access to my service by navigating to following address. Note that the name of SVC file is same as my assembly GUID for my COM+ component.
http://localhost/comcomponent/52daf9e2-eb00-49c2-9795-041f8c2738c3.svc
At the end, I can simply work with this service like other WCF services and use SvcUtil command tool to generate proxy class and client configuration files.
+ For first time in my life, Botulism has made me down! I feel better now but still need more time to get back to normal life!
Original Post: Expose a WCF Service From a COM+ Component
The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.