473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Setting web service location dynamically

Hi,

I have a production, test and development environment for my web application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g. Web.config? I
don't want to recompile the web application every time I move it to another
environment, nor do I want the code to be much more complicated than with a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund
Nov 19 '05 #1
8 1500
> Is it possible to let the web services location be set in e.g. Web.config?

The location is simply wherever you copy it to...
I
don't want to recompile the web application every time I move it to another environment,


Why do you think you would have to?

-Jimmy
Nov 19 '05 #2
In visual studio change the property 'URL Behavior' of the web service
reference from 'static' to 'dynamic' this will automatically add an entry to
your web config for you
--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"Nils Magnus Englund" <ni*****************@orkfin.no> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a production, test and development environment for my web application and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g. Web.config? I don't want to recompile the web application every time I move it to another environment, nor do I want the code to be much more complicated than with a hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service specified by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund

Nov 19 '05 #3
Something along the lines of:

dim ws as new myWebService

ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"

You could store the IP address in the web.config and just read it in before
setting the ws.url.

Hope this helps
Chris.

"Nils Magnus Englund" wrote:
Hi,

I have a production, test and development environment for my web application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g. Web.config? I
don't want to recompile the web application every time I move it to another
environment, nor do I want the code to be much more complicated than with a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund

Nov 19 '05 #4
Hi Jimmy,

Thank you for your reply, but I'm afraid you misunderstood - although I can
place the web service wherever I want to, I need to somehow be able to refer
the web application to the web service. How can I tell the web application
the location of the web service? One method is by hardcoding it into the
solution, but I wanted to do it dynamically, so I didn't have to recompile
the solution when changing the web services hardcoded location.
Regards,
Nils Magnus Englund

"Jimmy Tharpe" <ji**********@aps-soft.com> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Is it possible to let the web services location be set in e.g.
Web.config?


The location is simply wherever you copy it to...
I
don't want to recompile the web application every time I move it to

another
environment,


Why do you think you would have to?

-Jimmy

Nov 19 '05 #5
Hi Chris, and thanks for your reply.

I think I indeed could do that, but that wouldn't let Visual Studio
automatically make the classes and return types I need to fetch data from
the web methods. It would however work great if I only used basic .NET types
for the web application <> web service communication.
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Something along the lines of:

dim ws as new myWebService

ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"

You could store the IP address in the web.config and just read it in
before
setting the ws.url.

Hope this helps
Chris.

"Nils Magnus Englund" wrote:
Hi,

I have a production, test and development environment for my web
application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g.
Web.config? I
don't want to recompile the web application every time I move it to
another
environment, nor do I want the code to be much more complicated than with
a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service
specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund

Nov 19 '05 #6
Hi Ollie,

Thank you! I feel slightly embarassed for not figuring that out by myself ;)
That was exactly the kind of functionality I was looking (and hoping) for.
Regards,
Nils Magnus Englund
"Ollie Riches" <ol**********@phoneanalser.net> wrote in message
news:eu*************@TK2MSFTNGP15.phx.gbl...
In visual studio change the property 'URL Behavior' of the web service
reference from 'static' to 'dynamic' this will automatically add an entry
to
your web config for you
--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"Nils Magnus Englund" <ni*****************@orkfin.no> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a production, test and development environment for my web

application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g.
Web.config?

I
don't want to recompile the web application every time I move it to

another
environment, nor do I want the code to be much more complicated than with

a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service

specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund


Nov 19 '05 #7
I don't understand what you mean that it would work great only if you used
basic .NET types. Changing the URL doesn't affect what the web service can
return. All it's doing is changing the location of the web service which is
what I thought you wanted to do. Did I miss something?

Chris.

"Nils Magnus Englund" wrote:
Hi Chris, and thanks for your reply.

I think I indeed could do that, but that wouldn't let Visual Studio
automatically make the classes and return types I need to fetch data from
the web methods. It would however work great if I only used basic .NET types
for the web application <> web service communication.
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Something along the lines of:

dim ws as new myWebService

ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"

You could store the IP address in the web.config and just read it in
before
setting the ws.url.

Hope this helps
Chris.

"Nils Magnus Englund" wrote:
Hi,

I have a production, test and development environment for my web
application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g.
Web.config? I
don't want to recompile the web application every time I move it to
another
environment, nor do I want the code to be much more complicated than with
a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service
specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund


Nov 19 '05 #8
Hi Chris,

No, sorry, I missed something :) I thought you meant instantiating a basic
web service, not my own web service (missed the crucial _my_WebService
definition). Your method would work great as well! Thanks a lot :)
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I don't understand what you mean that it would work great only if you used
basic .NET types. Changing the URL doesn't affect what the web service can
return. All it's doing is changing the location of the web service which
is
what I thought you wanted to do. Did I miss something?

Chris.

"Nils Magnus Englund" wrote:
Hi Chris, and thanks for your reply.

I think I indeed could do that, but that wouldn't let Visual Studio
automatically make the classes and return types I need to fetch data from
the web methods. It would however work great if I only used basic .NET
types
for the web application <> web service communication.
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
> Something along the lines of:
>
> dim ws as new myWebService
>
> ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"
>
> You could store the IP address in the web.config and just read it in
> before
> setting the ws.url.
>
> Hope this helps
> Chris.
>
> "Nils Magnus Englund" wrote:
>
>> Hi,
>>
>> I have a production, test and development environment for my web
>> application
>> and a web service (The test web application connects to the test web
>> service, and so on).
>>
>> Is it possible to let the web services location be set in e.g.
>> Web.config? I
>> don't want to recompile the web application every time I move it to
>> another
>> environment, nor do I want the code to be much more complicated than
>> with
>> a
>> hardcoded location. The web service methods and classes are identical
>> for
>> all three environments, so I could let VS.NET talk to the development
>> web
>> service for figuring out class definitions etc. (I just want the
>> actual
>> communication when the web app is in use to be to the web service
>> specified
>> by each environment).
>>
>> Hope I made it clear to you what I'm trying to figure out :)
>>
>> Thanks!
>>
>>
>> Regards,
>> Nils Magnus Englund
>>
>>
>>


Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marina | last post by:
Hi, I need to have a windows service that can access various DLL's dynamically. These dll's are stored in a particular directory, but of course this can vary by application. The problem is...
3
by: moflaherty | last post by:
This code works great in a windows application: // Dynamically load the DLL sDLLName = "..\\bin\\Test2.dll"; Assembly objAssembly = System.Reflection.Assembly.LoadFrom(sDLLName); // Create an...
11
by: Frank Rizzo | last post by:
Hello, My c# based windows service takes a while to dispose. I have to release bunch of resources all over the place and unfortunately it can take 20-40 seconds before I can cleanly exit. ...
7
by: Ollie Riches | last post by:
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEncoderLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console...
11
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: archana | last post by:
Hi all, I want to developed plug-in architecture in windows service. What i want is to develop one windows service which will monitor some folders and as soon as it gets any file on folder it...
8
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.