.NET Conditional Web Services
My C# application has three testing stages: alpha, staging and production. Each stage for my application has a sibling web service. The APIs for all three web services are the same.
How could my application use the appropriate sibling web service based solely on alterations to the web.config 开发者_Python百科file?
The goal being to have very little duplicate code, and for the source for my application to be the same across all stages.
If you use WCF, the endpoint can easily be defined entirely in the config file.
quick case for xml web services: define some appsettings and whenever you new a proxy, use the appsetting as the constructor arg.
but steven has a better suggestion for you, use WCF if you can.
精彩评论