cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

twApi_SetSelfSignedOk() equivalent in .NET SDK?

SOLVED
Highlighted
Newbie

twApi_SetSelfSignedOk() equivalent in .NET SDK?

I'm trying to create a test program with .NET SDK but it doesn't seem to be working.

I've got a working version ready made with C SDK but we'd need to get the actual program working on .NET SDK while there're other components requiring it.

With C SDK I had problems without twApi_SetSelfSignedOK() function call so I thought if that'd be the case here also. Only similar method I found from .NET SDK is calling ClientConfigurator.ignoreSSLErrors(true) but the code ain't working with that.

Otherwise the codes are pretty similar, both a bit modified from SteamSensor examples (property changes etc). .NET program doesn't even get to the communication logs on ThingWorx as opened WebSocket, as didn't the program with C without the twApi_SelfSignedOK() call.

Only thing that seem to matter I get by debugging the code with Visual Studio was this line in the outputs (no errors):

A first chance exception of type 'System.Security.Authentication.AuthenticationException' occurred in System.dll

Not sure if this means anything related to connection problems but it's a guess.

While running the code, ConnectedThingClient.start() works without throwing any Exceptions but it's not connected. Tried seperately the .connect() method but that does no difference.

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

I believe the specific function you are looking for is AcceptSelfSignedCertificates(<Boolean>). The ThingWorx Edge/Connectivity Help Center has a very helpful document that will explain this function as well as the other configuration parameters that are available to the .NET SDK ClientConfigurator Class:

http://support.ptc.com/cs/help/thingworx_hc/thingworx_edge/index.jspx?id=dotnetsdk_topics-c_dotnet_s...

View solution in original post

7 REPLIES 7

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

I believe the specific function you are looking for is AcceptSelfSignedCertificates(<Boolean>). The ThingWorx Edge/Connectivity Help Center has a very helpful document that will explain this function as well as the other configuration parameters that are available to the .NET SDK ClientConfigurator Class:

http://support.ptc.com/cs/help/thingworx_hc/thingworx_edge/index.jspx?id=dotnetsdk_topics-c_dotnet_s...

View solution in original post

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

Hi, and thanks for your reply!

I'm using Thingworx dotNet SDK 5.0.1.103 and it doesn't seem to have such function, at least in com.thingworx.communications.client.ClientConfigurator class.

There're also quite many other functions in that documentation that it doesn't seem to have.

Thank you for the link, I'll keep looking further into it.

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

Miikka, it looks like you are using an older version of the dotNet SDK. Our current released version is 5.5. Please do download the new one and retry.

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

Thank for the hint!

I downloaded the 5.5 SDK from marketplace but now I can't seem to add neither x86 nor x64 version of twApi.dll as reference to the project.


Please make sure that the file is accessible, and that it is a valid assembly or COM component.





Tried also copying the file to another location (which absolutely was accessible) and adding from there but got the same notice.

EDIT: I'm using .NET Framework 4.5 in case that matters

EDIT 2: Tried with IL dissembler and got the error:


error:
'C:\.......\twApi.dll' has no valid CLR header and cannot be disassembled



OK, I manually copied the tw directory inside bin/Debug and got it working.

Thanks for all your help for both of you!

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

No problem, glad you got it working

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

I also used .NET SDK 5.5, and try to rebuild SteamSensor example. I got exact the same error --> can not add either x86 or x64 version of twApi dll as reference to the project.

I have tried to use .NET Framework 3.5 or 4.5, and the result is the same.

Can you describe in more detail regarding how to make it work in manual?

Thanks.

Re: twApi_SetSelfSignedOk() equivalent in .NET SDK?

Falcon, on Windows, you need to copy over the 'tw' folder (which contains x86 and x64 sub folders along with the dll) to \Documents\Visual Studio 2013\Projects\Project_Name\bin\Debug