I am trying to host several WCF REST services on the same port. I started Net.Tcp Port Sharing Service and this is my app.config file:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="MyService">
<host>
<baseAddresses>
<add baseAddress="http://localhost/services/"/>
</baseAddresses>
</host>
<endpoint
address="test"
binding="webHttpBinding"
contract="IMyService"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="PortSharingEnabled" portSharingEnabled="true">
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
I still cannot host two services on the same port.
When I try to run the second service, I get the following error: http://screencast.com/t/Vlakb26XbuQr. "The Service service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs".
Trace log (http://screencast.com/t/tJ5Gvmy4Dgm7) says: "HTTP could not register URL http://+:7778/MyServiceName/. Another application has already registered this URL with HTTP.SYS."
EDIT:
<services>
<service name="Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:7778/"/>
</baseAddresses>
</host>
<endpoint
address="first"
binding="webHttpBinding"
contract="IService1"/>
</service>
<service name="Service2">
<host>
<baseAddresses>
<add baseAddress="http://localhost:7778/"/>
</baseAddresses>
</host>
<endpoint
address="second"
binding="webHttpBinding"
contract="IService2"/>
</service>
</services>
I suppose something is missing to enable port sharing?