简体   繁体   中英

.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 file?

The goal being to have very little duplicate code, and for the source for my application to be the same across all stages.

如果使用WCF,则可以轻松地在配置文件中完全定义终结点。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM