简体   繁体   English

.NET条件Web服务

[英].NET Conditional Web Services

My C# application has three testing stages: alpha, staging and production. 我的C#应用​​程序具有三个测试阶段:Alpha,过渡和生产。 Each stage for my application has a sibling web service. 我的应用程序的每个阶段都有一个同级Web服务。 The APIs for all three web services are the same. 所有三个Web服务的API都是相同的。

How could my application use the appropriate sibling web service based solely on alterations to the web.config file? 我的应用程序如何仅基于对web.config文件的更改来使用适当的同级Web服务?

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. xml Web服务的快速案例:定义一些appsettings,每当您新建一个代理时,都将appsetting用作构造函数arg。

but steven has a better suggestion for you, use WCF if you can. 但史蒂文为您提供更好的建议,请尽可能使用WCF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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