title: Could not create SSL/TLS secure channel from plugin to web service
body: <p>I have a problem with my plugin when I try to use a method from service reference. I have a <strong>client</strong> that sends parameters to a <strong>web service</strong>, that then sends those parameters to <strong>my plugin</strong>, then I have to take those parameters and send them to a <strong>web service</strong> using a <strong>web reference method</strong>. To access the web service I need to use a certificate that was sing by the company that owns the last web service. The code that I use is this:</p>
  
  <pre><code>BasicHttpsBinding binding = new BasicHttpsBinding
              {
                  Security = new BasicHttpsSecurity
                  {
                      Transport = new HttpTransportSecurity
                      {
                          ClientCredentialType = HttpClientCredentialType.Certificate
                      }
                  }
              };
  
  UploaderServiceClient client = new UploaderServiceClient(binding, new EndpointAddress(args.EndPoint));
  
  client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocaMachine, StoreName.My, X509FindType.FindBySerialNumber, args.SerialNum);
  
  client.approveTransportDocument(appC, FileDesc);
  </code></pre>
  
  <p>After I use this code I get an exception:</p>
  
  <pre><code>The request was aborted: Could not create SSL/TLS secure channel.
  </code></pre>
  
  <p>The last web service works fine and the certificate is valid because if I use the same code on a form it works fine.
  EDIT:
  I'm adding the exception I get maybe it will help:</p>
  
  <blockquote>
    <p>System.ServiceModel.Security.SecurityNegotiationException: Could not
    establish secure channel for SSL/TLS with authority 'imas-ws.vmi.lt'.
    ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.    at
    System.Net.HttpWebRequest.GetResponse()    at
    System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
    timeout)    --- End of inner exception stack trace ---</p>
    
    <p>Server stack trace:     at
    System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException
    webException, HttpWebRequest request, HttpAbortReason abortReason)<br>
    at
    System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
    timeout)    at
    System.ServiceModel.Channels.RequestChannel.Request(Message message,
    TimeSpan timeout)    at
    System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
    message, TimeSpan timeout)    at
    System.ServiceModel.Channels.ServiceChannel.Call(String action,
    Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
    Object[] outs, TimeSpan timeout)    at
    System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
    methodCall, ProxyOperationRuntime operation)    at
    System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
    message)</p>
    
    <p>Exception rethrown at [0]:     at
    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
    reqMsg, IMessage retMsg)    at
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;
    msgData, Int32 type)    at
    Eur_Iz.Ie.UploaderService.submitTransportDocument(TransportDocument
    LocalTransportDocument, FileDescription ContextInformation,
    AdditionalContext AdditionalContext)    at
    Eur_Iz.Ie.UploaderServiceClient.submitTransportDocument(TransportDocument LocalTransportDocument, FileDescription ContextInformation,
    AdditionalContext AdditionalContext) in u:\DPb\Plns\Eur_Iz\Service
    References\Ie\Reference.cs:line 3295    at
    Eur_Iz.ClientPlugin.DataHandling(IServicePluginArgs args)</p>
  </blockquote>