localhost on development machine, localwebserver on live site :(

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey,

How do you tell a web service to resolve to localwebserver vs. localhost?

in reference.map I see
....
<DiscoveryClientResult
referenceType="System.Web.Services.Discovery.ContractReference"
url="http://localhost/[InstallationIISVirtualDir]/[WebServiceName].asmx?wsdl"
filename="[WebServiceName].wsdl" />
<DiscoveryClientResult
referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference"
url="http://localhost/[InstallationIISVirtualDir]/[WebServiceName].asmx?disco" filename="[WebServiceName].disco" />

....

It's an easy change to change localhost to localwebservice but I have three
questions..

can we use a web.config setting and post it into the reference
programmatically?

What if we add to reference.map two DiscoveryClientResult elements with
localwebserver?

What if we in code tell it before the web service method is invoked? e.g.
[WebServiceName] ws = new ....
ws.url = http://localwebserver...
Or do you have a suggestion?
 
Hey,

How do you tell a web service to resolve to localwebserver vs. localhost?

in reference.map I see
...
<DiscoveryClientResult
referenceType="System.Web.Services.Discovery.ContractReference"
url="http://localhost/[InstallationIISVirtualDir]/[WebServiceName].asmx?wsdl"
filename="[WebServiceName].wsdl" />
<DiscoveryClientResult
referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference"
url="http://localhost/[InstallationIISVirtualDir]/[WebServiceName].asmx?disco"
filename="[WebServiceName].disco" />

...

It's an easy change to change localhost to localwebservice but I have
three
questions..

can we use a web.config setting and post it into the reference
programmatically?

What if we add to reference.map two DiscoveryClientResult elements with
localwebserver?

What if we in code tell it before the web service method is invoked? e.g.
[WebServiceName] ws = new ....
ws.url = http://localwebserver...
Or do you have a suggestion?

Setting it programmatically via the url property is OK, since the URL is
set in the constructor by the default implementation. So if you set it as
you noted there, it would update.

But the easiest way (if using VS.NET) is to right click on the reference
and set the URL Behavior to Dynamic. Then the proxies will use a
web.config reference. See the proxy class code afterwards to see how it
works.

Don't know how to do this using command-line, but I'm sure you could do it
there as well (get it dynamic) if you generate proxies that way.
 
Back
Top