2

I am building a WCF service interface for an existing Windows service process. The purpose of the WCF interface is to provide an "Command Channel" to implement an administrative capability for the Windows Service. There are several OperationContract methods defined that are intended to extract information from and control the behaviour of the Windows service far beyond the Start/Stop/Pause capability of the Services applet.

This WCF service is intended to be part of the existing process. As such, running the WCF service in IIS or ServiceHost is not an option.

My problem is that although the ServiceHost does not throw an error on Open(), I cannot get "WCF Test Client" (or anyting else) to find the service.

This is my first WCF Service, and have had trouble finding examples or patterns that fit what I am trying to do. So I have no illusions and would not be suprised if I did many things wrong. Also, not that I have 'portSharingBinding=false'. I did have that on but it was throwing an error that pointed to another service that I do not wish to run. Is port sharing required?

Config 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 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, no error on the Open(). But, no success connecting to the service.

Thanks for your time,
Jim

1 Answer 1

4

I can only speak to the WCF Test Client, but it is looking for the metadata for your service so it can generate a proxy for it. From the above configuration, it does not appear that you are exposing a metadata exchange endpoint. Take a look at this link for more info:

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 exposed metatdata to generate a proxy, but it will require you to manually create channels to do so:

http://msdn.microsoft.com/en-us/library/ms734681.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.