简体   繁体   English

c#以编程方式添加服务引用

[英]c# programmatically add service reference

I created a visual studio 2012 C# class library, that uses a several service references. 我创建了一个visual studio 2012 C#类库,它使用了几个服务引用。 I have a development endpoint and test endpoint(ie dev.addtwonumbers?WSDL and test.addtwonumber?WSDL). 我有一个开发端点和测试端点(即dev.addtwonumbers?WSDL和test.addtwonumber?WSDL)。 I was wondering if there was a easy way in VS2012 to change the endpoints, without going to each of the service reference. 我想知道在VS2012中是否有一种简单的方法来更改端点,而无需访问每个服务引用。

The endpoint actually used at run time is controlled in your config file (usually App.config or Web.config, depending on what sort of project you're in). 在运行时实际使用的端点在配置文件中控制(通常是App.config或Web.config,具体取决于您所在的项目类型)。 You can use Web.config transformations or an equivalent for other config files (eg SlowCheetah or a more manual approach ) to swap between your different endpoint configurations easily. 您可以使用Web.config转换或其他配置文件的等效项(例如SlowCheetah更多手动方法 )轻松地在不同的端点配置之间进行切换。

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

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