Example #1
0
 /// <summary>
 /// Creates a new client channel if the communication object is null or
 /// is faulted, closed or closing.
 /// </summary>
 private void InitChannel()
 {
     lock (_padlock)
     {
         if (_commObj == null || 
             (_commObj.State != CommunicationState.Opened &&
             _commObj.State != CommunicationState.Opening))
         {
             if (!string.IsNullOrEmpty(_configurationName))
             {
                 _client = new ChannelFactory<IProxyTraceService>(_configurationName).CreateChannel();
             }
             else
             {
                 // Todo - is None really the best choice of security mode?
                 // maybe we should secure the transport by default???
                 NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                 EndpointAddress address = new EndpointAddress(DefaultEndpointAddress);
                 _client = ChannelFactory<IProxyTraceService>.CreateChannel(binding, address);
                 
             }
             _commObj = (ICommunicationObject)_client;
         }
     }
 }
Example #2
0
 /// <summary>
 /// Creates a new client channel if the communication object is null or
 /// is faulted, closed or closing.
 /// </summary>
 private void InitChannel()
 {
     lock (_padlock)
     {
         if (_commObj == null ||
             (_commObj.State != CommunicationState.Opened &&
              _commObj.State != CommunicationState.Opening))
         {
             if (!string.IsNullOrEmpty(_configurationName))
             {
                 _client = new ChannelFactory <IProxyTraceService>(_configurationName).CreateChannel();
             }
             else
             {
                 // Todo - is None really the best choice of security mode?
                 // maybe we should secure the transport by default???
                 NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                 EndpointAddress     address = new EndpointAddress(DefaultEndpointAddress);
                 _client = ChannelFactory <IProxyTraceService> .CreateChannel(binding, address);
             }
             _commObj = (ICommunicationObject)_client;
         }
     }
 }