简体   繁体   English

WCF app.config用于发布和测试

[英]WCF app.config for release and for test

For example in Web.config it is possible to have Web.Release.config 例如,在Web.config ,可以具有Web.Release.config

where is some database connection defined like: 在哪里定义一些数据库连接,如:

<connectionStrings>
   <!-- live db connection -->
</connectionStrings>

and Web.Test.config with: Web.Test.config具有:

<connectionStrings>
   <!-- test db connection -->
</connectionStrings>

Question : is is possible to make the similar construction for app.config to consume different Services depending on build target? 问题 :是否可以对app.config进行类似的构造以根据构建目标使用不同的服务?

Background information: if I use Add Service Reference... in Visual Studion than some URL is used and it generate endpoints: 背景信息:如果我在Visual Studion中使用“ 添加服务引用...” ,则使用某些URL并生成端点:

<endpoint address />

To switch to other endpoint I have to change app.config manually or generate new Service Reference 要切换到其他端点,我必须手动更改app.config或生成新的服务参考

Yes, there is a plugin to visual studio called SlowCheetah that add config transform capabilities to app.config files, just the same way as it works for web.config . 是的,Visual Studio有一个名为SlowCheetah的插件,该插件向app.config文件添加了配置转换功能,与web.config工作方式相同。 It's very useful - I don't understand why it isn't included as default functionality in Visual Studio. 这非常有用-我不明白为什么Visual Studio不将其作为默认功能包括在内。

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

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