tags:

views:

416

answers:

2

I have a WCF client and service using HTTPS over the wsHttpBinding.

One common setup has the client and server components on the same machine. The client has to set the endpoint address to include the server's machine name, rather than localhost for SSL reasons i.e. https://mymachine/myservice/service.svc

The problem is, that the default IIS has an IP restriction whitelist to 127.0.0.1 only. If I browse the svc file in IE7, this works, but when using the WCF client I can see in the IIS logs, that the the WCF server receives messages from the WCF client's network/real IP address, rather than 127.0.0.1, and therefore the client is rejected.

Does anyone know why the WCF client is communicating locally, using the network IP, rather 127.0.0.1, and can this be changed?

Any other workarounds are appreciated, but I'm really looking to avoid changing the SSL setup, or overhauling the bindings. The simplest solution appears to be to update the whitelist on system restart with the clients new IP.

Note that I have tried adding my machinename, with IP 127.0.0.1 in the hosts file, but this hasn't had an effect.

A: 

Does replacing

https://mymachine/myservice/service.svc

with

https://localhost/myservice/service.svc

work?

Matt Davis
Unfortunately not, due to SSL certificate being the machinename, and not localhost
MattH
A: 

My recollection with older versions of windows is that Windows is a little annoying in this category, because it seems to be self-naming. In other words, rather than letting ALL naming obey your configuration choices for DNS and /etc/hosts, Windows seems to think it can server the information for its own hostname (even if it might be different than what the external naming service says).

So, what you might be seeing is that Windows is matching the hostname to the IP address of the main interface. That would explain why you cannot map the hostname with /etc/hosts.

(FYI: This is my interpretation of my past personal experiences and the problem description. I did not spend time working with this configuration, so there could be more to this than I mentioned.)

benc
Accepted: As there are no opinions disputing this answer, and no better ones.
MattH