localhost on development machine, localwebserver on live site :(

Discussion in 'ASP .Net' started by =?Utf-8?B?RXNraW1v?=, Apr 8, 2005.

  1. 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?

    --
    tym, Eskimo
     
    =?Utf-8?B?RXNraW1v?=, Apr 8, 2005
    #1
    1. Advertising

  2. On Fri, 08 Apr 2005 13:23:02 -0500, Eskimo
    <> wrote:

    > 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.

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
     
    Craig Deelsnyder, Apr 8, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jiong Feng
    Replies:
    0
    Views:
    877
    Jiong Feng
    Nov 19, 2003
  2. Alex
    Replies:
    4
    Views:
    587
    Hasani Blackwell
    Feb 8, 2005
  3. =?Utf-8?B?S2VuTGVl?=
    Replies:
    5
    Views:
    2,732
  4. EdwardH

    Localhost isn't localhost

    EdwardH, Sep 29, 2005, in forum: Java
    Replies:
    20
    Views:
    6,435
    Roedy Green
    Oct 1, 2005
  5. koicat
    Replies:
    0
    Views:
    243
    koicat
    Jul 2, 2010
Loading...

Share This Page