.NET WCF service references use server name rather than IP address causing issues when consuming

iisnetwcf

So, I'm a newbie to WCF…

I created my ServiceLibrary and web-site project that consumed the ServiceLibrary. I am able to access the service by creating a proxy class from the WSDL that was generated using svcutil.exe and then used this class to access the methods in my service. All of this was fine on my local machine.

I then moved the service to my test development server (not on the domain, so I am accessing via an IP address) and added the site to IIS. I was able to access the service via //ip/ServiceSite/Service.svc and the WSDL via //ip/ServiceSite/Service.svc?wsdl.

However, when trying to consume this service I received an error about references being incorrect. When I look at the //ip/ServiceSite/Service.svc the link that is provided to generate the proxy class contains the machine name of the server in the address and when I look at the WSDL the references to the schemas also contain the machine name
in the URL. This machine name cannot be accessed over the network as it is not on the domain.

Is there a way that instead of the machine name for the server being placed in those references that it would use the IP address? Or are there any other solutions to be able to access the service by IP address?

Best Answer

Put

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

befor closing the system.serviceModel tag. It should end like this:

<system.serviceModel > 
       .
       .
       .
   <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel >
Related Topic