I have strange problem with my WCF REST configuration. I would like to point a network interface on which TCP is listening for incoming messages (I have two network adapters). But whatever I put as a hostname in base address, TCP is always listening on 0.0.0.0 (all interfaces).
This is my App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="RestServiceSample.ServiceImpl" behaviorConfiguration="ServiceBehaviour">
<endpoint address="service" binding="webHttpBinding"
contract="RestServiceSample.IService"
behaviorConfiguration="web">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://192.168.0.100:3880/MyService"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
And code:
var serviceHost = new ServiceHost(new ServiceImpl());
serviceHost.Open();
So I want to listen on 192.168.0.100 but when I run netstat I can see that there is TCP connection listening on 0.0.0.0:3880.
When I set hostNameComparisonMode="Exact"
in binding configuration then TCP listening on correct interface but I cannot connect to service by domain name - only by IP address of network adapter.
Any ideas how to play with that without setting hostNameComparisonMode="Exact"
property?