【发布时间】:2014-11-14 08:48:09
【问题描述】:
WCF 配置增强
背景:
在app.config 或web.config 中可以定义一个配置条目:
<appSettings>...</appSettings>
像这样:
<add key="MyKey" value="%SomeEnvironmentVariable%"/>
此后为了检索与MyKey 关联的值,可以使用以下两行代码:
string raw = ConfigurationManager.AppSettings[“MyKey”];
string cooked = (raw == null) ? null : Environment.ExpandEnvironmentVariables(raw);
问题:
有没有办法对 WCF 服务配置做同样的事情,例如:
<system.serviceModel>
. . .
<services>
<service name="..." ...>
. . .
<endpoint
address="%MyEndPointAddress%" ... />
. . .
</service>
</services>
</system.serviceModel>
任何知识都将受到高度赞赏。
--Avi
【问题讨论】:
标签: c# wcf configuration