zoukankan      html  css  js  c++  java
  • wcf获取配置节问题

    new ChannelFactory<IAdoHelper>(“”);这种方式在单元测试下通过,但是在压力测试下报“找不到配置节”错误。

    采用new ChannelFactory<IAdoHelper>(bind, address);这种方法不会报错。

                           ClientSection client = ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;
                            foreach (ChannelEndpointElement el in client.Endpoints) {
                                if (string.Equals(el.Name, "adoService")) {

                                    EndpointAddress address = new EndpointAddress(el.Address);
                                    NetTcpBinding bind = new NetTcpBinding();

                                    BindingsSection binds = ConfigurationManager.GetSection("system.serviceModel/bindings") as BindingsSection;
                                    foreach (NetTcpBindingElement emelent in binds.NetTcpBinding.ConfiguredBindings) {
                                        if (string.Equals(emelent.Name, el.BindingConfiguration)) {
                                            emelent.ApplyConfiguration(bind);
                                        }
                                    }

                                    _channelFactory = new ChannelFactory<IAdoHelper>(bind, address);
                                    _channelFactory.Open();

                                }

                            }

    这种做法还不行。

    哪位兄弟遇见过这种情况指点一下。


  • 相关阅读:
    tomcat7项目启动报错java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
    Android APP 分享图片文字到微信刚開始正常,后面就不弹出分享框了
    Akka 编程: 什么是Actor
    【3C认证】安防产品3C认证
    设计模式之装饰模式
    关于那些常见的坑爹的小bug(会持续更新)
    【Mac双系统设置系统默认启动系统】解决方式
    JEECG常见问题大全征集
    关于最新的Vuforia-unity3d-samples2-8-13
    python-print
  • 原文地址:https://www.cnblogs.com/tommyli/p/1446404.html
Copyright © 2011-2022 走看看