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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

twApi_SetSelfSignedOk() equivalent in .NET SDK?

miikkae
12-Amethyst

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.

ACCEPTED SOLUTION

Accepted Solutions
jeff11
7-Bedrock
(To:miikkae)

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_sdk_reference_clientc…

View solution in original post

7 REPLIES 7
jeff11
7-Bedrock
(To:miikkae)

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_sdk_reference_clientc…

miikkae
12-Amethyst
(To:jeff11)

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.

Aanjan
12-Amethyst
(To:miikkae)

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.

miikkae
12-Amethyst
(To:Aanjan)

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!

Aanjan
12-Amethyst
(To:miikkae)

No problem, glad you got it working

admin11
7-Bedrock
(To:miikkae)

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.

Aanjan
12-Amethyst
(To:admin11)

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

Announcements


Top Tags