internal static TransientChannelTicket CreateTransientChannel(LogicalChannel logicalChannel) { DiagnosticUtility.DebugAssert(logicalChannel != null, "logical channel cannot be null"); ChannelFactory factory = null; IChannel channel = null; bool channelOpened = false; try { factory = ChannelManagerHelpers.CreateChannelFactory(logicalChannel.ConfigurationName, logicalChannel.ContractType); channel = ChannelManagerHelpers.CreateChannel(logicalChannel.ContractType, factory, logicalChannel.CustomAddress); channelOpened = true; } finally { if (!channelOpened) { if (channel != null) { ChannelManagerHelpers.CloseCommunicationObject(channel); } if (factory != null) { ChannelManagerHelpers.CloseCommunicationObject(factory); } } } return(new TransientChannelTicket(channel, factory)); }
protected override void Close() { if (this.channel != null) { ChannelManagerHelpers.CloseCommunicationObject(this.channel); this.channel = null; } if (this.factory != null) { ChannelManagerHelpers.CloseCommunicationObject(this.factory); this.factory = null; } }
public void Close(TimeSpan timeout) { ChannelManagerHelpers.CloseCommunicationObject(this.channelFactory, timeout); }
public void Abort() { ChannelManagerHelpers.CloseCommunicationObject(this.channelFactory); }