titanium-as / TitaniumAS.Opc.Client

Open source .NET client library for OPC DA
MIT License
193 stars 94 forks source link

Exception when connecting to RSLinx server: class not registered #24

Open sanzor opened 6 years ago

sanzor commented 6 years ago

Hello, I am trying to connect to an RSLinx server with Titanium and i get the following exception:

**An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in TitaniumAS.Opc.Client.dll

Additional information: CoCreateInstanceEx: Class not registered**

Is RSLinx not supported?

iceoneye commented 6 years ago

the same as you

alexey-kachalov commented 6 years ago

Hi! Have you already tried the same program on Matrikon?

sanzor commented 6 years ago

I do not posess Matrikon.

alexey-kachalov commented 6 years ago

@sanzor , I meant that you can try you program with MatrikonOPC Explorer/MatrikonOPC Simulation Server (https://www.matrikonopc.com/products/opc-drivers/opc-simulation-server.aspx) first. The TitaniumAS.Opc.Client library should work with it.

sanzor commented 6 years ago

Well i am using Allen Bradley hardware with RSLinx server that is why i was interested if it is supported.I am sorry i shouldn't have placed this question at "Issues" ,more like at questions.

alexey-kachalov commented 6 years ago

@sanzor, it is ok. :) The TitaniumAS.Opc.Client intends to work with all OPC DA servers with versions 1.0, 2.05A, 3.0. But sometimes it cannot work with particular OPC DA servers, because of the implementation specifics of the OPC DA server. To make it clear, that your problem connected with the RSLinx, TitaniumAS.Opc.Client or your client program, try the program with MatrikonOPC Explorer/MatrikonOPC Simulation Server. If it works, the problem with the communication between the TitaniumAS.Opc.Client and RSLinx.

iceoneye commented 6 years ago

I've tried before. Other opc clients,such as Matrikon-OPCClient,Kepware-OPCClient, etc. can read RSLinx OPC server.

sanzor commented 6 years ago

I am currently using OPC .Net Foundation version for OPC.DA with RSLinx and it is working.Unfortunately the classic OPC DA does not provide PLC tag mapping.I need at runtime to get all the datastructures declared inside the PLC program (not the values ,the tag-schema).I don't know how to do that and Titanium's autobrowse function looked perfect for what i needed.

imphat commented 5 years ago

I have the same problem. On my local machine (windows 7) I am running a Matrikon emulator and it works just fine, but when I deploy to an RSLinx Windows 2012 machine, I get the same error.

alexey-kachalov commented 5 years ago

It seems we should look into RSLinx interaction.

sfaulkner commented 5 years ago

I might know why this happens, the RSLinx OPC Server has spaces in the name where the Matrikon and Citect ones do not, that is the only thing I can find different about why the RSLinx one fails. When I use the overload to pass GUID and hostname (after finding the RSLinx OPC Server GUID in the Registry) it does connect. Unfortunately you can't change the name of the RSLinx OPC Server from what I've found.

ThePhilomathsApprentice commented 2 years ago

@sfaulkner can you please elaborate on how to find the GUID of RSLinx. I am facing the same issue.

sfaulkner commented 2 years ago

@ThePhilomathsApprentice I don't have the code to verify this anymore but I believe the key is located at Computer\HKEY_CLASSES_ROOT\RSLinx OPC Server\CLSID. Hope that helps.

ThePhilomathsApprentice commented 2 years ago

Resolved it using Matrikon Explorer GUI: -Connect to the server using Matrikon explorer. -Right click on the server Name. -Click Properties. -GUID is written there: {}

xjbob commented 2 years ago

I do not posess Matrikon.

it support “Matrikon” and “Kepware.KEPServerEX.V6”,i use 。but “RSLinx OPC Server” and “National Instruments.NIOPCServers.V5” same problem as you。

xjbob commented 2 years ago

I might know why this happens, the RSLinx OPC Server has spaces in the name where the Matrikon and Citect ones do not, that is the only thing I can find different about why the RSLinx one fails. When I use the overload to pass GUID and hostname (after finding the RSLinx OPC Server GUID in the Registry) it does connect. Unfortunately you can't change the name of the RSLinx OPC Server from what I've found.

how to "overload to pass GUID and hostname " i wirte code as" OpcDaServer server = new OpcDaServer(UrlBuilder.Build("RSLinx OPC Server")); or OpcDaServer server = new OpcDaServer(UrlBuilder.Build("{A05BB6D5-2F8A-11D1-9BB0-080009D01446}")); " not work

but code as " OpcDaServer server = new OpcDaServer(UrlBuilder.Build("A05BB6D5-2F8A-11D1-9BB0-080009D01446")); “ it work

problem is progid "RSLinx OPC Server" has space character?