Basically, in your service, you should be able to define any number of service endpoints on any number of ports.
There's two ways to do this:
- define a base address and a relative address in your service endpoint
- define the full address in each endpoint
If you do option #1, you'll have something like this:
<service name="YourService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://YourServer:5151/Services" />
</baseAddresses>
</host>
<endpoint name="endpoint1"
address="Service1"
binding="netTcpBinding"
contract="IYourService" />
<endpoint name="endpoint2"
address="Service2"
binding="netTcpBinding"
contract="IYourService" />
</service>
So in this case, you have two service endpoints for the same contract, and they'll be listening on URLs
net.tcp://YourServer:5151/Services/Service1
and
net.tcp://YourServer:5151/Services/Service2
You can have mulitple service endpoints, but only one base address.
The other option is to specify no base addresses and specify your full service address in the endpoint directly:
<service name="YourService">
<endpoint name="endpoint1"
address="net.tcp://YourServer:5151/Services/Service1"
binding="netTcpBinding"
contract="IYourService" />
<endpoint name="endpoint2"
address="net.tcp://YourServer:6868/Services/Service2"
binding="netTcpBinding"
contract="IYourService" />
</service>
In this case, since you're defining the whole address in the endpoint, you can pick two different TCP ports, one for each endpoint. This should work with no problem at all. You have two separate endpoints on two separate ports, both listening and being serviced by the same service class in the background.
Marc