已答覆 WCF issues with SSL, Could not create SSL/TLS secure channel

  • 12. března 2012 18:41
     
     

    Hello,

    We have a number of services that we connect to using following SSL.  The format of the service addresses would look similar to the following:  https://101.1.2.3/SampleService/SampleService.svc

    Occasionally, we have noticed through the logs that we receive the following error:  "The request was aborted:  Could not create SSL/TLS secure channel."  Is there anything that we can do to reduce to eliminate the error within the service?  Some research has been done into the issue so far, and something involving the ServicePointManager may help out.

    Has anyone had any experience with this sort of error?

    Thanks!

Všechny reakce

  • 12. března 2012 20:32
     
     

    After researching the matter, the following website was brought to my attention that might have a potential solution to the issue:

    http://stackoverflow.com/questions/6232746/c-sharp-httpwebrequest-sec-i-renegotiate-intermittent-errors

    The site mentions adding the following two lines as a potential solution:

    ServicePointManager.Expect100Continue = true;

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

    What the post seemingly doesn't mention well exactly, is where should these lines of code be placed in relation to your service.  Should these lines be placed in the WCF service itself, or do these properties need to be set in the application that is calling the WCF service (right before the call to _client.WCFServiceFunction() )?

  • 12. března 2012 21:44
     
     Odpovědět
  • 12. března 2012 21:54
     
     

    rupex:  Should those two lines be repeated in the client before every call to a WCF function, or should they only be in there once (perhaps in a constructor)?

  • 13. března 2012 12:00
    Moderátor
     
     Odpovědět
    Hello, rupex is correct. That code should be put on the client side. You only need to call it once, before you invoke any service operations.

    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email.