473,748 Members | 7,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web References how to config to read URL from config?

Bob
It's great that VS.NET makes it so effortless to add a web reference to a
web service. The problem is, I haven't figured out a way to configure the
URLs (or simply switch the references to another web reference) easily when
I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I have
done is copying the Reference.cs file out and creating a separate class by
modifying it, letting it read the URL from say, my app config file. This is
manual and if I have a change to the service, I have to manually modified
these proxy classes too. I just keep thinking if VS.NET made it this far,
allowing a dynamic config of the web reference shouldn't be too difficult.
Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob
Nov 18 '05 #1
7 3347
There are many reasons to go down the road of manually crafted proxies, but
this isn't one of them. Change the URL Behavior property for the web
reference to Dynamic - a app settings entry will be created and added to
your config file - changing the URL in the app settings value will direct
the client proxy to the new endpoint.
(Click the web reference in the solution tree and press F4).

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com/blogs/mickey
" Bob" <bo*******@yaho o.com> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
It's great that VS.NET makes it so effortless to add a web reference to a
web service. The problem is, I haven't figured out a way to configure the
URLs (or simply switch the references to another web reference) easily when I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I have
done is copying the Reference.cs file out and creating a separate class by
modifying it, letting it read the URL from say, my app config file. This is manual and if I have a change to the service, I have to manually modified
these proxy classes too. I just keep thinking if VS.NET made it this far,
allowing a dynamic config of the web reference shouldn't be too difficult.
Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob

Nov 18 '05 #2
I actually set it as static, such that there is no binary difference between
any of the files on my development machine and the production version.
Having different versions of the config file seems to me to be just one more
source of potential problems when creating the set of distribution files.

Instead, I add an entry in the HOSTS file for the URL when I want to run the
service locally.

Just an alternative solution, I thought I would share.

" Bob" <bo*******@yaho o.com> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
It's great that VS.NET makes it so effortless to add a web reference to a
web service. The problem is, I haven't figured out a way to configure the
URLs (or simply switch the references to another web reference) easily when I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I have
done is copying the Reference.cs file out and creating a separate class by
modifying it, letting it read the URL from say, my app config file. This is manual and if I have a change to the service, I have to manually modified
these proxy classes too. I just keep thinking if VS.NET made it this far,
allowing a dynamic config of the web reference shouldn't be too difficult.
Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob

Nov 18 '05 #3
Bob
Jerry, could you elaborate a little more on what you said? Isn't it true
that the development machine would almost always have newer binary than the
production if new features are being added frequently?

Keeping the config file different on dev vs. production is definitely a pain
but I'm not sure it can be avoided, different database connection strings
would be a very common reason for them to be different.

I'd definitely like to know more about what you do to reconcile these
things.

Thanks
Bob

"Jerry Goldin" <NoSpam@p a r i n c . c o m> wrote in message
news:ej******** ******@TK2MSFTN GP10.phx.gbl...
I actually set it as static, such that there is no binary difference between any of the files on my development machine and the production version.
Having different versions of the config file seems to me to be just one more source of potential problems when creating the set of distribution files.

Instead, I add an entry in the HOSTS file for the URL when I want to run the service locally.

Just an alternative solution, I thought I would share.

" Bob" <bo*******@yaho o.com> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
It's great that VS.NET makes it so effortless to add a web reference to a web service. The problem is, I haven't figured out a way to configure the URLs (or simply switch the references to another web reference) easily when
I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I have
done is copying the Reference.cs file out and creating a separate class by modifying it, letting it read the URL from say, my app config file. This is
manual and if I have a change to the service, I have to manually

modified these proxy classes too. I just keep thinking if VS.NET made it this far, allowing a dynamic config of the web reference shouldn't be too difficult. Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob


Nov 18 '05 #4
Bob, it is true that the files during development typically are newer than
the currently released version, but my concern is keeping my working copy
identical to what I have under source-control. I have a setup with
SourceSafe's working directory mapped to my development directory and I
would like to avoid a case where I accidentally get the wrong file checked
in (or accidentally have it replaced with the production version).

I am not in all cases and all projects able to do this, but to the extent
that I can, I try to keep archived files identical to the files I use during
development.

" Bob" <bo*******@yaho o.com> wrote in message
news:Oj******** ******@TK2MSFTN GP11.phx.gbl...
Jerry, could you elaborate a little more on what you said? Isn't it true
that the development machine would almost always have newer binary than the production if new features are being added frequently?

Keeping the config file different on dev vs. production is definitely a pain but I'm not sure it can be avoided, different database connection strings
would be a very common reason for them to be different.

I'd definitely like to know more about what you do to reconcile these
things.

Thanks
Bob

"Jerry Goldin" <NoSpam@p a r i n c . c o m> wrote in message
news:ej******** ******@TK2MSFTN GP10.phx.gbl...
I actually set it as static, such that there is no binary difference between
any of the files on my development machine and the production version.
Having different versions of the config file seems to me to be just one

more
source of potential problems when creating the set of distribution files.

Instead, I add an entry in the HOSTS file for the URL when I want to run

the
service locally.

Just an alternative solution, I thought I would share.

" Bob" <bo*******@yaho o.com> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
It's great that VS.NET makes it so effortless to add a web reference to a web service. The problem is, I haven't figured out a way to configure the URLs (or simply switch the references to another web reference) easily when
I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I
have done is copying the Reference.cs file out and creating a separate

class by modifying it, letting it read the URL from say, my app config file. This
is
manual and if I have a change to the service, I have to manually

modified these proxy classes too. I just keep thinking if VS.NET made it this far, allowing a dynamic config of the web reference shouldn't be too difficult. Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob



Nov 18 '05 #5
Bob
Thanks Mickey. That's what I was looking for.

Since I have the proxy classes in my data layer class library assembly,
changing it to dynamic created an app.config file in my project. I guess I
can add the same app settings entry to the web.config of my web project that
will ultimately use the assembly. What are some of the examples you think
manually crafted proxy classes are necessary? I have been struggling with
some of the things that I'm not sure whether to edit the proxies or create
another layer.

Thanks
Bob

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:OD******** ******@tk2msftn gp13.phx.gbl...
There are many reasons to go down the road of manually crafted proxies, but this isn't one of them. Change the URL Behavior property for the web
reference to Dynamic - a app settings entry will be created and added to
your config file - changing the URL in the app settings value will direct
the client proxy to the new endpoint.
(Click the web reference in the solution tree and press F4).

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com/blogs/mickey
" Bob" <bo*******@yaho o.com> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
It's great that VS.NET makes it so effortless to add a web reference to a web service. The problem is, I haven't figured out a way to configure the URLs (or simply switch the references to another web reference) easily when
I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I have
done is copying the Reference.cs file out and creating a separate class by modifying it, letting it read the URL from say, my app config file. This is
manual and if I have a change to the service, I have to manually

modified these proxy classes too. I just keep thinking if VS.NET made it this far, allowing a dynamic config of the web reference shouldn't be too difficult. Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob


Nov 18 '05 #6
> What are some of the examples you think
manually crafted proxy classes are necessary? I have been struggling with
some of the things that I'm not sure whether to edit the proxies or create
another layer.


Manually created proxies are useful when:
- Sharing types among multiple endpoints
- You want to subclass the client proxy (instead of
SoapHttpClientP rotocol)
- You don't care for the current method implementation, or you want a
different set of methods - maybe you want to get rid of the pseudo-asynch
methods in the auto-generated proxy, or you want to inject logging or
validation code.

We typically use manual proxies once we leave the prototyping stage, but
that's partially because we tend to be fairly stable along our interfaces.
The largest problem you'll face is keeping the manual proxy synchronized
with the proxy target.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com/blogs/mickey
Nov 18 '05 #7
You can check out following article's to know more about dynamic webservices
http://www.codeproject.com/useritems...asp?print=true
http://msdn.microsoft.com/library/de...us/vsintro7/ht
ml/vxwlkwalkthroug hredirectingapp licationtotarge tdifferentxmlwe bservicedurin
ginstallation.a sp

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

" Bob" <bo*******@yaho o.com> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
It's great that VS.NET makes it so effortless to add a web reference to a
web service. The problem is, I haven't figured out a way to configure the
URLs (or simply switch the references to another web reference) easily when I move my app from development, to staging, to production, as I have
corresponding environments for the web services too. So far what I have
done is copying the Reference.cs file out and creating a separate class by
modifying it, letting it read the URL from say, my app config file. This is manual and if I have a change to the service, I have to manually modified
these proxy classes too. I just keep thinking if VS.NET made it this far,
allowing a dynamic config of the web reference shouldn't be too difficult.
Yet I can't figure out how to do this. Could anyone give me some
suggestions?

Thanks
Bob

Nov 18 '05 #8

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

Similar topics

13
3019
by: Maxim Khesin | last post by:
I want to have a config file with my python proggie, satisfying the following requirements: 1) support key->(value, default) 2) simple and intuitive to read and edit 3) easyly readable into a python datastructure (a dictionary?) 4) not requiring any heavy libraries needed (I am distributing my proggie as a py2exe executable and do not want to bloat the size) can you guys suggest some format for this? thanks, max
4
3828
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply* access config files. This is version 3, which is a big overhaul. It extends ConfigObj to reading config files with sections and various other simplifications. I find ConfigObj extremely easy to use and use it for reading config files and data...
1
1675
by: Eddy | last post by:
Problem: In 'solution A', 'project 1' references 'project 2'. As such, when 'solution A' is built (debug mode), project '1' creates a dll in /debug, and project '2' referneces that dll. All is good. When 'solution A' is built in release mode however, 'project 1' is recompiled and the new dll is put into '/release', but 'project 2' still references the dll from project '1's /debug folder, and as such is compiled using the older /debug version of...
10
1780
by: Ricola ! | last post by:
Two c# dll's were compiled and added to the GAC. They appear in the .NET Configuration tool. However, when trying to add a reference to a new project, the dlls do not appear in the .NET property sheet. Why not?
18
3794
by: Praveen Ramesh | last post by:
Hi, Is there any way to add the @Assembly reference to the aspx files programmatically from inside a custom control (when it gets dropped on to the page from the toolbox)? I have a custom control - MyControl that implements an interface in another custom assembly - InterfaceAssembly. When MyControl gets dropped on to the page and run, it results in a "InterfaceAssembly not found" exception. I am aware that this can be fixed by...
2
1194
by: WebMatrix | last post by:
Hello, Just created my first ASP.NET 2.0 project with Visual Studio 2005. I see they changed some very important things. So, I have the follwoing questions: 1. How can I view and remove project references. I can add references from the project menu, but where is reference "folder" which used to be in VS 2003 from which I could add or remove references. 2. I see that there's no bin folder, project still compiles and runs, that's
1
2038
by: mndang | last post by:
Hi All, This may have been posted before and such, but I tried a few solutions on the web but to no avail. Problem: I have a web projects (not Web Application Project) with many project references and a few 3rd party references. The 3rd party references are automatically added to the web.config file as another <add assembly/element via the VS.NET 2005 IDE.
7
2511
by: eschneider | last post by:
I have a webservice which every time I build it keeps adding Crystal references into the web.config? <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/> <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/> And No, I do not have any references to crystal when I look at project
20
2405
by: David Thielen | last post by:
Hi; When we add a reference to a web app, where is that information stored? There is no project file, it's not in the web.config or solution file. ??? - thanks - dave david@at-at-at@windward.dot.dot.net Windward Reports -- http://www.WindwardReports.com
0
8989
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9243
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8241
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.