How to Repoint without Recompiling

D

David Schornack

I sure I am just missing something simple, but how can I repoint my
webservice client application from my development server to my test or
production server without recompiling. Currently I have included all three
web services into my client application and I just comment out the ones I am
not using.

//using com.development.www;
//using com.production.www;
using localhost;

Can I include some directive in my Web.config. I am using Visual Studio
..Net 2003. My Web Service is an ASP.NET webservice as is my client.

Thanks
David
 
M

Manohar Kamath

The trick is in not using the static URL in the proxy class. Or better, when
you instantiate the proxy object, set the URL to be either production/test.
You can pick up the value from the App.config/Web.Config file.

webProxy myProxy = new webProxy();
myProxy.Url = ConfigurationSettings.AppSettings("WebServiceURL");

and in the App.config


<appSettings>
<add key="WebServiceURL" value=http://myserver/myservice.asmx />
</appSettings>

Hope that helps.
 
D

David Schornack

It does. After I posted, I realized that I may need to write my own proxy
class instead of having VS write one for me. It is nice having one written,
but you do lose flexibility.

Thanks
David Schornack
 
M

Manohar Kamath

Actually no... the proxy generated classes do just fine, except they will
have the Url property set to the URL at the design time. You can override
this by setting the property at run time.
 
D

David Schornack

Thank You!!!

Manohar Kamath said:
Actually no... the proxy generated classes do just fine, except they will
have the Url property set to the URL at the design time. You can override
this by setting the property at run time.
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top