I am using WCF with NetTcpBinding on a solution where both client and server are windows forms. The service is hosted by one of them. I am using VS.2012.
On the server side I have several service contracts (related) all of which are implemented in a single service class. Like this:
public class MyService : IServiceA, IServiceB
{
}
and they should be accessible via net.tcp://localhost:4545/control/ which would lead to the following service addresses:
IServiceA (endpoint alphaEP) : net.tcp://localhost:4545/control/ASvc/
IServiceB (endpoint betaEP) : net.tcp://localhost:4545/control/BSvc/
And when I use svcutil.exe to generate the client stuff I see that it generates TWO service client classes, one for each interface, so when I use the ServiceBClient it generates an exception inidicating it could not find a 'betaEP' with contract 'IServiceB' even though the app.config has the same binding configuration and has both endpoints defined
<bindings>
<netTcpBinding>
<binding name="alphaEP">
<reliableSession enabled="true" />
<security mode="None" />
</binding>
<binding name="betaEP">
<reliableSession enabled="true" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
and this
<client>
<endpoint address="net.tcp://localhost:4545/control/ASvc"
binding="netTcpBinding" bindingConfiguration="alphaEP"
contract="CodeDom.IServiceA" name="alphaEP">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:4545/control/BSvc"
binding="netTcpBinding" bindingConfiguration="betaEP" contract="CodeDom.IServiceB"
name="betaEP">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
Why can't it find the endpoint if this client app.config was generated by svcutil.exe based on the server configuration?
Why does it generates two client classes instead of a single one? would that be the source of the problem? I have multiple related services to expose and I don't want to occupy more than one port on that. Do note, this is Net TCP Binding.