0
votes

I'm currently using QuickOPC library from OPC Labs. My current purpose is to write a .NET Console App to read item values from a Matrikon Simulation OPC server.

The simulation server is running on a remote machine with IP address available, and I need to enter username and password to login to this remote machine.

My current code is as follows:

NetworkSecurity networkSecurity = new NetworkSecurity(UserName, Password, MachineName);
ServerDescriptor serverDescriptor = new ServerDescriptor("\\\\xxx.xxx.xxx.xxx\\Matrikon.OPC.Simulation.1", networkSecurity);
serverDescriptor.Scheme = "opcda";
DAItemDescriptor itemDescriptor = new DAItemDescriptor(ItemID);

Console.WriteLine(client.ReadItemValue(serverDescriptor, itemDescriptor));

The exception is as follows:

Exception: An OPC operation failure with error code -1073442759 (0xC0049039) occ urred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inn er exception contains details about the problem. Inner Exception: No method available to convert ProgID to CLSID.

If I try to use CLSID

ServerDescriptor("\\\\xxx.xxx.xxx.xxx\\{F8582CF2-88FB-11D0-B850-00C0F0104305}", networkSecurity);

The exception becomes:

Exception: An OPC operation failure with error code -2147024891 (0x80070005) occ urred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inn er exception contains details about the problem. Inner Exception: Access is denied.

1
I represent OPC Labs, a QuickOPC maker. As indicated in the answers and comments by other users here, this is a DCOM security issue. To explain the original error message, if the OPCEnum method does not work, QuickOPC also tries to resolve the ProgID using so-called Remote Registry. If no method succeeds, you get this error message. If your admin is unwilling to enable DCOM, he will most likely be unwilling to enable Remote Registry as well - and, you will still DCOM for the actual OPC communication anyway. - ZbynekZ
@ZbynekZ Thanks for your reply. Your answer definitely make sense, though we have decided to install my OPC client on the same machine of the server. Therefore, it works fine now without enabling DCOM. - Christopher

1 Answers

1
votes

"Inner Exception: Access is denied", meaning you have to enable DCOM communication between the server and client. Both for the server application and for OPCEnum service (which is used to convert ProgID to CLSID).

https://www.google.com/search?q=dcom+configuration+for+opc