views:

24

answers:

1

I have a webservice that works locally but when I publish it to our web server the auto-generated WSDL uses the server's name rather than the host name.

I have searched the internet but only found complex answers. There should be a simple web.config change or class attribute setting to change the target location.

Basically the auto-generated WSDL uses this location (host name) "http://servername.domain.com" rather than "http://services.desireddomain.com"

I even tried saving the auto-generated copy and manually changing the target locations. But that didn't work either for some reason; it seems that it should have.

Thanks for you help!

A: 

What version of Visual Studio WSDL.exe are you using to generate your endpoint stub? Is it a standard .NET .asmx, WCF .svc, or something else? What I have done in the past to provide a staging / production switch for my endpoints is create a constructor which changes the Uri of a stub being generated by Visual Studio 2005/2008 WSDL.exe tool. I have found that the newer 'Service References' are generated with multiple constructors which allow you to pass in an endpoint configuration name or remote address to either refer to an endpoint configured in your application configuration or to explicitly define your endpoint address respectively.

Soundsoldier