惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
小众软件
小众软件
D
Docker
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX
博客园 - 叶小钗
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
IT之家
IT之家
博客园 - 司徒正美
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog

博客园 - DataFlow

word break 在不同浏览器中的表现 系统架构 创造HTTPS的是个神 为Chrome开发插件提高工作效率 Javascript 控制style 小结 svcutil 生成代理类时的问题 xeam Build Definition Extension uninstall 卸载 屏蔽电信流氓弹出广告 正则替换中的一个Bug SQL server 性能相关 SQL Express 相关 时间格式 输出一个在没有.Net 环境的机器也可以跑得安装包 再谈性能力 SCOM Configuration NumSamples and Absolute XML中的时间 decimal.Round 的区别 Dos中常用的命令 反序列化怪现象,数组无父
Wcf客户端配置里Endpoint的Name属性无效
DataFlow · 2013-02-17 · via 博客园 - DataFlow

<client>
      <endpoint address="http://..."
        binding="basicHttpBinding" bindingConfiguration="..."
        contract="..." name="endpoint1" />

</clent>

之后, 当我们在程序里读取endpoint.Name时,却发现怎么也找不到endpoint1,会返回BindingName_ContractName

code:

 Code:

private ServiceEndpoint CreateServiceEndpoint()
{
    TypeLoader loader = new TypeLoader();
    ServiceEndpoint serviceEndpoint = new ServiceEndpoint(loader.LoadContractDescription(this.contractType));
    if (this.address != null)
    {
        serviceEndpoint.Address = new EndpointAddress(new Uri(this.address), this.identity, new AddressHeader[0]);
    }
    if (this.binding != null)
    {
        serviceEndpoint.Binding = this.binding;
    }
    if (this.configurationName != null)
    {
        new ConfigLoader().LoadChannelBehaviors(serviceEndpoint, this.configurationName);
    }
    ComPlusTypedChannelBuilderTrace.Trace(TraceEventType.Verbose, 0x5001e, "TraceCodeComIntegrationTypedChannelBuilderLoaded", this.contractType, this.binding);
    return serviceEndpoint;
}

完全没有Name的什么事,算不算重大bug, 所以干脆直接配置成"bindingName+_+contractName",以免混淆视听