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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Unable to load DLL 'twApi.dll'

jmaasland
1-Visitor

Unable to load DLL 'twApi.dll'

We are trying to set up a OPC DA connection. After installing and configuring the extension from the installation manual, we get the below error messages when starting the OPC client service? The error repeats every 15 seconds.

2016-06-12 23:19:02.085Z [L: Information] [T: 1] [U: SYSTEM] [O: com.thingworx.services.HostService] Initializing Service...

2016-06-12 23:19:03.205Z [L: Information] [T: 1] [U: SYSTEM] [O: com.thingworx.services.HostService] Initialization complete.

2016-06-12 23:19:03.327Z [L: Information] [T: 4] [U: SYSTEM] [O: com.thingworx.services.HostService] Starting Service...

2016-06-12 23:19:03.422Z [L: Information] [T: 4] [U: SYSTEM] [O: com.thingworx.services.HostService] Service started.

2016-06-12 23:19:04.052Z [L: Error] [T: 5] [U: SYSTEM] [O: com.thingworx.communications.client.TwApiWrapper] Error initializing the .NET SDK. : System.DllNotFoundException: Unable to load DLL 'twApi.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)     at com.thingworx.communications.client.TwApiWrapper.twW_SetLoggerProperties(TwApiLogLevel level, Byte isVerboseEnabled, TwLogMessageDelegate onLogMessage)     at com.thingworx.communications.client.TwApiWrapper.ConfigureTwApiLogger()     at com.thingworx.communications.client.TwApiWrapper.Initialize(ClientConfigurator config)

2016-06-12 23:19:19.083Z [L: Error] [T: 5] [U: SYSTEM] [O: com.thingworx.communications.client.TwApiWrapper] Error initializing the .NET SDK. : System.DllNotFoundException: Unable to load DLL 'twApi.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)     at com.thingworx.communications.client.TwApiWrapper.twW_SetLoggerProperties(TwApiLogLevel level, Byte isVerboseEnabled, TwLogMessageDelegate onLogMessage)     at com.thingworx.communications.client.TwApiWrapper.ConfigureTwApiLogger()     at com.thingworx.communications.client.TwApiWrapper.Initialize(ClientConfigurator config)

What have we forgotten?

Regards, Jan

ACCEPTED SOLUTION

Accepted Solutions

First of all make sure you have "tw" folder which contains Newtonsoft.Json.dll, thingworx-dotnet-common.dll and two folders "x64" and x"86" which contains twApi.dll in it.

 

Now as seen in attached image you have to set property (Copy to local directory) of all above 4 dlls as "copy always" in the file property.

 

Build the solution and run. You wont see this error anymore.

View solution in original post

10 REPLIES 10

Jan, can you try Riaan's answer marked as correct from the following thread 43992 ?

Let me know if this helps.

We are not programming ourselves, just installing the OPC-DA client. So this does not help us.

Aanjan
12-Amethyst
(To:jmaasland)

Jan, what version of the OpcDA client are you running? Can you open/ edit 'ThingWorxOPCService.exe' and scroll down to the <switches> flag and change the value from Information to Verbose. Please post the new set of logs as well.

The version is 5.6.1.1100.

How can I change the logging switch? It is an executable.

I have found the switch. It is in the config file of the executable.

I don't think it makes any change in the logging.

2016-06-13 17:31:27.439Z [L: Information] [T: 1] [U: SYSTEM] [O: com.thingworx.services.HostService] Initialization complete.

2016-06-13 17:31:27.454Z [L: Information] [T: 4] [U: SYSTEM] [O: com.thingworx.services.HostService] Starting Service...

2016-06-13 17:31:27.517Z [L: Verbose] [T: 5] [U: SYSTEM] [O: com.thingworx.services.HostService] Using Platform uri: wss://192.168.11.105:8443/Thingworx/WS

2016-06-13 17:31:27.579Z [L: Error] [T: 5] [U: SYSTEM] [O: com.thingworx.communications.client.TwApiWrapper] Error initializing the .NET SDK. : System.DllNotFoundException: Unable to load DLL 'twApi.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)     at com.thingworx.communications.client.TwApiWrapper.twW_SetLoggerProperties(TwApiLogLevel level, Byte isVerboseEnabled, TwLogMessageDelegate onLogMessage)     at com.thingworx.communications.client.TwApiWrapper.ConfigureTwApiLogger()     at com.thingworx.communications.client.TwApiWrapper.Initialize(ClientConfigurator config)

2016-06-13 17:31:27.579Z [L: Information] [T: 4] [U: SYSTEM] [O: com.thingworx.services.HostService] Service started.

2016-06-13 17:31:42.600Z [L: Error] [T: 5] [U: SYSTEM] [O: com.thingworx.communications.client.TwApiWrapper] Error initializing the .NET SDK. : System.DllNotFoundException: Unable to load DLL 'twApi.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)     at com.thingworx.communications.client.TwApiWrapper.twW_SetLoggerProperties(TwApiLogLevel level, Byte isVerboseEnabled, TwLogMessageDelegate onLogMessage)     at com.thingworx.communications.client.TwApiWrapper.ConfigureTwApiLogger()     at com.thingworx.communications.client.TwApiWrapper.Initialize(ClientConfigurator config)

2016-06-13 17:31:57.608Z [L: Error] [T: 5] [U: SYSTEM] [O: com.thingworx.communications.client.TwApiWrapper] Error initializing the .NET SDK. : System.DllNotFoundException: Unable to load DLL 'twApi.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)     at com.thingworx.communications.client.TwApiWrapper.twW_SetLoggerProperties(TwApiLogLevel level, Byte isVerboseEnabled, TwLogMessageDelegate onLogMessage)     at com.thingworx.communications.client.TwApiWrapper.ConfigureTwApiLogger()     at com.thingworx.communications.client.TwApiWrapper.Initialize(ClientConfigurator config)

Aanjan
12-Amethyst
(To:jmaasland)

Do you have a tw folder included in your OpcDA folder? If so, do you have both x64 and x86 subfolders under the tw folder, and do they both have the twApi.dll files?

There is a tw folder in de OpcDA folder having both the x64 and x86 subfolder. In both there is a version of the twapi.dll file.

Aanjan
12-Amethyst
(To:jmaasland)

Jan, as a quick test, can you try with an older version of the OpcDA client? 5.6.0 is our previous release.

mzablocki-2
5-Regular Member
(To:jmaasland)

Hi, 

I am facing the same problem.

Did you find a solution?

Thanks,
Maciej

First of all make sure you have "tw" folder which contains Newtonsoft.Json.dll, thingworx-dotnet-common.dll and two folders "x64" and x"86" which contains twApi.dll in it.

 

Now as seen in attached image you have to set property (Copy to local directory) of all above 4 dlls as "copy always" in the file property.

 

Build the solution and run. You wont see this error anymore.

Announcements


Top Tags