Issue adding a link to a WCF service hosted on a Windows service
I am creating a WCF Service Interface for an existing Windows Service Process. The purpose of the WCF interface is to provide a "Command Channel" for implementing administrative capabilities for a Windows service. There are several OperationContract methods defined that are designed to retrieve information and control the behavior of a Windows service far beyond the Start / Stop / Pause capabilities of Services applets.
This WCF service is designed to participate in an existing process. So starting a WCF service in IIS or ServiceHost is not an option.
My problem is that although ServiceHost is not throwing an error in Open (), I cannot get the "WCF Test Client" (or anything else) to find the service.
This is my first WCF service and I haven't been able to find examples or patterns that match what I'm trying to do. Therefore, I have no illusions, and I would not be surprised if I did something wrong. Also, not that I have "portSharingBinding = false". I had it, but it was an error indicating another service that I don't want to run. Is port separation required?
Configuration information:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="PortBinding" portSharingEnabled="false" />
</netTcpBinding>
</bindings>
<services>
<service name="NameChanged.ServiceManager.CommandService">
<endpoint address="net.tcp://localhost"
binding="netTcpBinding"
bindingConfiguration="PortBinding"
name="ServiceManagerCommandChannel"
contract="NameChanged.ServiceManager.ICommandService" />
</service>
</services>
</system.serviceModel>
I have also tried the no config route using the following code:
ServiceHost host = new ServiceHost(typeof(CommandService)))
host.AddServiceEndpoint(typeof(ICommandService),
new NetTcpBinding(), "net.tcp://localhost:8000");
host.Open();
Also, there is no bug on Open (). But there is no success in connecting to the service.
Thanks for your time
Jim
source to share
I can only talk to a WCF test client, but it looks for metadata for your service so that it can generate a proxy for it. It is not clear from the above configuration that you are viewing the metadata exchange endpoint. Take a look at this link for more information:
http://weblogs.asp.net/fabio/archive/2009/02/28/net-tcp-mex-endpoints-and-portsharing-in-wcf.aspx
You can access your service without using public metadata to create a proxy, but to do this, you will need to manually create channels:
source to share