on client side I try to create a proxy to my WCF service.
It created cool. But only small thing trouble me.
The matter I want it has and IP address as service name. But really has my machine name. Briefly
I have http://mycomputer/blabla in various site after generation
But I need it like this : http://93.48.56.74/blabla where 93.48.56.74 is the IP address of my computer where I generate this.
How to solve this?
The reason it is using your machine name, is because that is the address advertised in the generated WSDL. As commented, you can just modify your Web.config or App.config and it will use the IP address.
So much for the simple answer 🙂
Alternatively, you can change the WSDL. If you’re using .NET 4.0*, you can apply the
<useRequestHeadersForMetadataAddress>behavior to your service configuration.After the behavior has been added, the service metadata will advertise the same endpoint address that you use to retrieve the WSDL. So if you add a Service Reference to http://93.48.56.74/blabla, the proxy and configuration generated should use the IP address rather than the host name.
*: There is also a hotfix available for .NET 3.5: KB971842 (don’t mind the description of the hotfix)