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

A

ADingOD

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
 
L

Lewis Wang [MSFT]

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 <[email protected]>
| Subject: change Web References from web.config (or another solution?)
| Date: Fri, 15 Aug 2003 15:51:54 -0400
| Reply-To: (e-mail address removed)
| Message-ID: <[email protected]>
| 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
|
 
L

Lewis Wang [MSFT]

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" <[email protected]>
| References: <[email protected]>
<s0CH#[email protected]>
| 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: <[email protected]>
| 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
|
| | > 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 <[email protected]>
| > | Subject: change Web References from web.config (or another solution?)
| > | Date: Fri, 15 Aug 2003 15:51:54 -0400
| > | Reply-To: (e-mail address removed)
| > | Message-ID: <[email protected]>
| > | 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
| > |
| >
|
|
|
 
D

DDE

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.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top