2 Replies Latest reply on Jan 13, 2018 9:39 PM by rkandasamy RSS
    rkandasamy Apprentice

    How to configure Dotnet SDK with valid security certificate

    Hi Team,


    If any body has done connecting dot net SDK with valid security certificate to thingworx. Please provide the steps to be followed.

    like Adding certificate to MMC -> Local system, how to Refer the same in dot net SDK?

    I am stuck at adding security certificate to dot net SDK. Thanks.

      • Re: How to configure Dotnet SDK with valid security certificate
        rkandasamy Apprentice


        I have used the below configuration and tried to add the certificates through config variable but not working.

        URL: wss://******:443/Thingworx/WS  In the App.config file.


           mAppKey = ConfigurationManager.AppSettings["ServiceKey"].Trim();

                    SecurityClaims claims = SecurityClaims.fromAppKey(mAppKey);

                    config.ServerCertFileInfo = new CertFileInfo();

                    config.ServerCertFileInfo.FilePath = "../Incoming/RootCert.cer";

                                config.Claims = claims;

                    //config.AllowSelfSignedCertificates = false;

                    config.AutoReconnect = true;

                    config.ReconnectInterval = 5000;

                    config.DisableCertValidation = true;




        Results: I am getting the error as follows,

        com.thingworx.communications.client.TwApiWrapper Error: 0 : [Error] Error intializing SSL connection

        com.thingworx.communications.client.TwApiWrapper Error: 0 : [Error] twWs_Connect: Error restarting socket.  Error 0

        The program '[14540] EdgeSDK.vshost.exe' has exited with code 0 (0x0).

          • Re: How to configure Dotnet SDK with valid security certificate
            jknorr Newbie

            Hi, i have a similar problem when trying to connect with the .net SDK to Thingworx.

            I used this configuration:


            config.ServerCertFileInfo = new CertFileInfo();

            config.ServerCertFileInfo.FilePath = "pathtocer.cer";      

            config.AllowSelfSignedCertificates = false;

            config.DisableCertValidation = false;

            var claims = SecurityClaims.fromAppKey(appKey);         

            config.Claims = claims;


            It works fine if DisableCertValidation is set to true, but when the validation is enabled the following error occurs:

            "[Error] twTlsClient_Connect: Error intializing TLS connection.  Invalid certificate"


            I don't think that the certificate is the issue, because i used the same .cer file for validation when connecting with openssl to the server.


            Has anybody an idea what the problem might be or is there any other update on this topic?