9 Replies Latest reply on Jan 27, 2017 11:30 AM by cjackson RSS
    twitters Newbie

    .NET SDK - Application stuck at client.start()

    I followed the tutorial available in the 5.6.0.549 SDK download but cannot get the application past client.start().  I was able to get the C SDK running.  Any ideas on how I can figure out why the client.start() function is halting?

     

    Application parameters.

      • Re: .NET SDK - Application stuck at client.start()
        ianban Creator

        I have seen reports that the .NET SDK will only run in an HTTPS/WSS environment

          • Re: .NET SDK - Application stuck at client.start()
            lzhou Apprentice

            Really? WTF

              • Re: .NET SDK - Application stuck at client.start()
                ianban Creator

                .NET SDK will only run in HTTPS

                  • Re: .NET SDK - Application stuck at client.start()
                    lzhou Apprentice

                    It is not true,

                    Add  ConnectedThingClient.disableEncryption();

                    after  SteamSensorClient client = new SteamSensorClient(config);

                    in SteamSensorClient class

                    so it can run in HTTP/WS

                      • Re: .NET SDK - Application stuck at client.start()
                        rhodson Explorer

                        ling zhou wrote:

                         

                        It is not true,

                        Add  ConnectedThingClient.disableEncryption();

                        after  SteamSensorClient client = new SteamSensorClient(config);

                        in SteamSensorClient class

                        so it can run in HTTP/WS

                         

                        I am having a similar problem as Todd.

                         

                        The ThingWorx 6.6 C# SDK seems to be missing a bunch of methods that are required to connect to a secure ThingWorx server.

                        Everything compiles and runs (I have properly included all included references)

                        I tried following the help located at  Digital Media Publisher


                        SDK Steam Sensor Example Help

                        //Allow self-signed certificates
                        config.AllowSelfSignedCertificates = true;

                        //Disable certificate validation when using self-signed certificates
                        config.DisableCertValidation = true;


                        C# Emits the following Error

                        'ClientConfigurator' does not contain a definition for 'AllowSelfSignedCertificates' and no extension method 'AllowSelfSignedCertificates' accepting a first argument of type 'ClientConfigurator' could be found (are you missing a using directive or an assembly reference?)


                        'ClientConfigurator' does not contain a definition for 'DisableCertValidation' and no extension method 'DisableCertValidation' accepting a first argument of type 'ClientConfigurator' could be found (are you missing a using directive or an assembly reference?)

                         

                         

                        It appears that the API is broken now, or that there is no alternative documentation to explain what we are supposed to do now

                          • Re: .NET SDK - Application stuck at client.start()
                            rkandasamy Apprentice

                            Hi Team,

                             

                            I am also not able to connect to thingworx server using  dot net sdk with version 6.6 twApi.dll. I am not getting any error. but it is stuck with client.start() line.

                             

                            Note: With the same SDK i am able to connect to secured(https) server but not normal(http) one.

                             

                            Let me know if any body faced this issue and found a solution.

                              • Re: .NET SDK - Application stuck at client.start()
                                cjackson Explorer

                                That's funny I am having the opposite problem.

                                Using port 80 I can connect over http, but trying to connect on port 443 using wss, I cannot.

                                Here is how I connected with http:

                                URI = "ws://Blabla.thingworx.com:80/Thingworx/WS";


                                ConnectedThingClient.disableEncryption(); needs to be called

                                //Allow self-signed certificates

                                config.AllowSelfSignedCertificates = true;

                                //Disable certificate validation when using self-signed certificates

                                config.DisableCertValidation = true;

                                 

                                Now trying with https I have removed those 3 calls/property sets and changed my URI to

                                URI = "wss://Blabla.thingworx.com:443/Thingworx/WS";

                                And I get stuck in a connecting loop on Start.

                                I'm not familiar with logging and the SDK example/explanation is confusing and not helpful enough.

                                  • Re: .NET SDK - Application stuck at client.start()
                                    cjackson Explorer

                                    The problem is that you need to get the public certificate from the server and load it into the ClientConfigurator class.  Direct the filepath to the cert.  I had to ask TW how to get the cert, basically when you are logged into the platform you can click the secure Lock from the browser and get details on the cert / export it etc.  There are probably help topics on the web about extracting those, I used a plain text .pem format.

                                    //Set the .pem cert info

                                                config.ServerCertFileInfo = new CertFileInfo();

                                                config.ServerCertFileInfo.FilePath = args[2];

                                                config.AllowSelfSignedCertificates = false;

                                                config.DisableCertValidation = false;

                      • Re: .NET SDK - Application stuck at client.start()
                        jamesm Creator

                        They changed the location of where you call disableEncryption() when they rebuilt the C# SDK with the C SDK. The correct way to do this, now, is in the initialization method:

                         

                        public CoffeeRoasterClient(ClientConfigurator config)

                                    : base(config)

                                {

                                    CoffeeRoasterClient.disableEncryption();

                                }