localhost on development machine, localwebserver on live site :(

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?
 
C

Craig Deelsnyder

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top