/// <summary> /// Opens the channel before sending the request. /// </summary> private void OpenOnDemand() { // create the channel. m_channel = new TcpClientChannel( Guid.NewGuid().ToString(), m_bufferManager, m_quotas, m_settings.ClientCertificate, m_settings.ServerCertificate, m_settings.Description); //((TcpClientChannel)m_channel).ClientCertificateChain = m_settings.ClientCertificateChain; // begin connect operation. // IAsyncResult result = m_channel.BeginConnect(m_url, m_operationTimeout, null, null); // m_channel.EndConnect(result); }
/// <summary> /// Begins an asynchronous operation to open a secure channel with the endpoint identified by the URL. /// </summary> /// <param name="callback">The callback to call when the operation completes.</param> /// <param name="callbackData">The callback data to return with the callback.</param> /// <returns> /// The result which must be passed to the EndOpen method. /// </returns> /// <exception cref="ServiceResultException">Thrown if any communication error occurs.</exception> /// <seealso cref="Open"/> public IAsyncResult BeginOpen(AsyncCallback callback, object callbackData) { lock (m_lock) { // create the channel. m_channel = new TcpClientChannel( Guid.NewGuid().ToString(), m_bufferManager, m_quotas, m_settings.ClientCertificate, m_settings.ServerCertificate, m_settings.Description); //((TcpClientChannel)m_channel).ClientCertificateChain = m_settings.ClientCertificateChain; // begin connect operation. return m_channel.BeginConnect(this.m_url, m_operationTimeout, callback, callbackData); } }