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();

                                }

                            }

    这种做法还不行。

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


  • 相关阅读:
    js面向对象实现Tab切换
    js中的面向对象基础1
    js正则表达式
    Ajax的基础使用
    JS完美运动框架
    JS实现链式运动
    js实现多物体运动框架
    js实现多物体运动
    JS运动应用
    JavaScript中的高阶函数
  • 原文地址:https://www.cnblogs.com/tommyli/p/1446404.html
Copyright © 2011-2022 走看看