change Web References from web.config (or another solution?)

Discussion in 'ASP .Net Web Services' started by ADingOD, Aug 15, 2003.

  1. ADingOD

    ADingOD Guest

    Hi!

    It's any solution to change the Web References when the application is
    "moved" from "test" to "production" without a new compilation?

    I mean to use one "set" of webservices when is running on "test" and
    another "set" when is running on "production" without a recompilation.

    Any manual edit of web.config, registry... is permited.

    Thanks,
    Alexandru
     
    ADingOD, Aug 15, 2003
    #1
    1. Advertising

  2. Hi Alexandru,

    You can configure the web service to pull the URL based on a setting in a
    configuration file, rather than a hardcoded value. To change the location,
    simply change the config file with no recompile. Here is how to do it: Add
    your web reference. Go to "Solution Explorer", right click on the web
    reference name (eg. "localhost") and choose properties. In the property
    window change "Url Behavior" from "Static" to "Dynamic". If the web
    service client is a non-web application, this will automatically create a
    file name app.config with the URL to the web service.

    <appsettings><add key="myapplication.mywebservice.service1"
    value="http://webservices.myCompany.com/myServices.asmx" </appsettings>

    After you comiple your client app, the configuration file of it (such as
    something.exe.config) will have the same content as the app.config. Now,
    you can deploy the configuration along with the client executable. If you
    ever need to change the web service location, you can open the
    something.exe.config file in notepad and change the value attribute. If
    the web service client is a web application such as asp.net web form,
    changing "Url Behavior" from "Static" to "Dynamic" will automatically add
    the same appsettings to web.config. Now, if you ever need to change the web
    service location, you can open web.config file in notepad and change the
    value attribute.

    Best regards,
    Lewis

    This posting is provided "AS IS" with no warranties, and confers no rights.



    --------------------
    | From: ADingOD <>
    | Subject: change Web References from web.config (or another solution?)
    | Date: Fri, 15 Aug 2003 15:51:54 -0400
    | Reply-To:
    | Message-ID: <>
    | X-Newsreader: Forte Agent 1.8/32.553
    | MIME-Version: 1.0
    | Content-Type: text/plain; charset=us-ascii
    | Content-Transfer-Encoding: 7bit
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    | NNTP-Posting-Host: 12.154.68.2
    | Lines: 1
    | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    | Xref: cpmsftngxa06.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservices:18835
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    |
    |
    | Hi!
    |
    | It's any solution to change the Web References when the application is
    | "moved" from "test" to "production" without a new compilation?
    |
    | I mean to use one "set" of webservices when is running on "test" and
    | another "set" when is running on "production" without a recompilation.
    |
    | Any manual edit of web.config, registry... is permited.
    |
    | Thanks,
    | Alexandru
    |
     
    Lewis Wang [MSFT], Aug 18, 2003
    #2
    1. Advertising

  3. Hi Dominique,

    I think this problem can be better answered in microsoft.public.infopath,
    thanks.

    Best regards,
    Lewis

    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    | From: "DDE" <>
    | References: <>
    <s0CH#>
    | Subject: Re: change Web References from web.config (or another solution?)
    | Date: Tue, 19 Aug 2003 09:03:15 +0400
    | Lines: 78
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
    | Message-ID: <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    | NNTP-Posting-Host: p11-37.intnet.mu 202.123.11.37
    | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    | Xref: cpmsftngxa06.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservices:18871
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    |
    | Would this also work if the client is Infopath ???
    |
    | Thanks
    |
    | Dominique
    |
    | "Lewis Wang [MSFT]" <> wrote in message
    | news:s0CH#...
    | > Hi Alexandru,
    | >
    | > You can configure the web service to pull the URL based on a setting in
    a
    | > configuration file, rather than a hardcoded value. To change the
    location,
    | > simply change the config file with no recompile. Here is how to do it:
    | Add
    | > your web reference. Go to "Solution Explorer", right click on the web
    | > reference name (eg. "localhost") and choose properties. In the property
    | > window change "Url Behavior" from "Static" to "Dynamic". If the web
    | > service client is a non-web application, this will automatically create
    a
    | > file name app.config with the URL to the web service.
    | >
    | > <appsettings><add key="myapplication.mywebservice.service1"
    | > value="http://webservices.myCompany.com/myServices.asmx" </appsettings>
    | >
    | > After you comiple your client app, the configuration file of it (such as
    | > something.exe.config) will have the same content as the app.config. Now,
    | > you can deploy the configuration along with the client executable. If
    you
    | > ever need to change the web service location, you can open the
    | > something.exe.config file in notepad and change the value attribute. If
    | > the web service client is a web application such as asp.net web form,
    | > changing "Url Behavior" from "Static" to "Dynamic" will automatically
    add
    | > the same appsettings to web.config. Now, if you ever need to change the
    | web
    | > service location, you can open web.config file in notepad and change the
    | > value attribute.
    | >
    | > Best regards,
    | > Lewis
    | >
    | > This posting is provided "AS IS" with no warranties, and confers no
    | rights.
    | >
    | >
    | >
    | > --------------------
    | > | From: ADingOD <>
    | > | Subject: change Web References from web.config (or another solution?)
    | > | Date: Fri, 15 Aug 2003 15:51:54 -0400
    | > | Reply-To:
    | > | Message-ID: <>
    | > | X-Newsreader: Forte Agent 1.8/32.553
    | > | MIME-Version: 1.0
    | > | Content-Type: text/plain; charset=us-ascii
    | > | Content-Transfer-Encoding: 7bit
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    | > | NNTP-Posting-Host: 12.154.68.2
    | > | Lines: 1
    | > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    | > | Xref: cpmsftngxa06.phx.gbl
    | > microsoft.public.dotnet.framework.aspnet.webservices:18835
    | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    | > |
    | > |
    | > | Hi!
    | > |
    | > | It's any solution to change the Web References when the application is
    | > | "moved" from "test" to "production" without a new compilation?
    | > |
    | > | I mean to use one "set" of webservices when is running on "test" and
    | > | another "set" when is running on "production" without a recompilation.
    | > |
    | > | Any manual edit of web.config, registry... is permited.
    | > |
    | > | Thanks,
    | > | Alexandru
    | > |
    | >
    |
    |
    |
     
    Lewis Wang [MSFT], Aug 21, 2003
    #3
  4. ADingOD

    DDE Guest

    Right, it is the thread I initiated in infopath newsgroup ;-) . looks like
    there is no other solution in Infopath. Although I do not understand since I
    suppose Infopath has been written with .NEDT Framework SDK.

    Dominique


    Thanks anyway.
    "Lewis Wang [MSFT]" <> wrote in message
    news:...
    > Hi Dominique,
    >
    > This same question was brought up in the infopath newsgroup and was
    > answered. You can view that question and link into the answer at this URL
    > (please pardon the line breaks):
    > http://www.google.com/groups?safe=images&ie=
    > UTF-8&oe=UTF-8&as_umsgid=%3CO%247o2HuZDHA.
    > %3E&lr=&hl=en
    >
    > Hope this helps.
    >
    > Best regards,
    > Lewis
    >
    > This posting is provided "AS IS" with no warranties, and confers no

    rights.
    >
    > --------------------
    > | From: "DDE" <>
    > | References: <>
    > <s0CH#>
    > <>
    > <$>
    > | Subject: Re: change Web References from web.config (or another

    solution?)
    > | Date: Thu, 21 Aug 2003 11:22:58 +0400
    > | Lines: 19
    > | X-Priority: 3
    > | X-MSMail-Priority: Normal
    > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
    > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
    > | Message-ID: <>
    > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    > | NNTP-Posting-Host: p0-180.intnet.mu 202.123.0.180
    > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    > | Xref: cpmsftngxa06.phx.gbl
    > microsoft.public.dotnet.framework.aspnet.webservices:18919
    > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    > |
    > | I thought too ... but doesn't look like I can get an answer there.
    > |
    > | Dominique
    > |
    > |
    > | "Lewis Wang [MSFT]" <> wrote in message
    > | news:$...
    > | > Hi Dominique,
    > | >
    > | > I think this problem can be better answered in
    > microsoft.public.infopath,
    > | > thanks.
    > | >
    > | > Best regards,
    > | > Lewis
    > | >
    > | > This posting is provided "AS IS" with no warranties, and confers no
    > | rights.
    > |
    > |
    > |
    >
     
    DDE, Aug 22, 2003
    #4
    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. Bob
    Replies:
    7
    Views:
    980
    Saravana [MVP]
    May 5, 2004
  2. Maziar Aflatoun
    Replies:
    1
    Views:
    501
    =?Utf-8?B?UGF1bA==?=
    Jan 22, 2005
  3. CSharpner
    Replies:
    0
    Views:
    1,094
    CSharpner
    Apr 9, 2007
  4. Dan
    Replies:
    4
    Views:
    573
  5. Bob
    Replies:
    8
    Views:
    200
    Saravana [MVP]
    May 5, 2004
Loading...

Share This Page