views:

1894

answers:

2

A common issue for WCF appears to be how the hostname is resolved within the wsdl for the links to other files. The issue is that the machine name of the computer is placed into the wsdl to link the other wsdl files, so if you visit http://myhost/service.svc it may point to the rest of the wsdl on another location, ie http://mypc/service.svc?wsdl which obviously is something you cannot see externally.

There are a few solutions out there for this already, this being the common one. Where you can setup the host header.

My question is, how can i work around this when using an external IP. I'm connecting to a clients head-office from their website to retrieve data, its not setup with a dns etc and the ip re-routes to a machine internally. Is there any way to force the machine hosting the WCF to present the external address in the wsdl files rather than the machine name?

I'm using SSL for the connection, which may make a difference (as with the host headers).

+2  A: 

You need to configure the host header for secureBingings of website within IIS.

Here is an article about WCF WSDL & xsd:import schemaLocations link to local machine name not domain name while hosted in IIS

codemeit
Thanks for the answer, but that only covers scenarios where an alternative hostname is used. It does not resolve the question of using IP's to access the webservice.
dnolan
Have you tried to add th external IP to the host header e.g. \Securebindings "443:ip.ip.ip.ip" ?
codemeit
A: 

Yes, you can set an IP address as the host header. Just make sure that the external IP address is actually recognized internally as well. I learned this the hard way when in one of our projects, we are using an ISA Server as proxy.

If you ever encountered such a situation, and you still insist on using the external IP address as the host header, then you only option is to add the machine name of the web service into the hosts file.

alextansc