Remote OPC Connected but can't read

PLCNoob1

Member
Join Date
May 2015
Location
UK
Posts
1
I am writing a custom OPC Client application in C#, enabling reading of data from a RSLinx Server.

First of, I wasn't able to connect to the RSLINX Opc Server remotely. Exception Access Denied kept occurring.

I then alteredthe DCOM Settings of MyComputer -> Com Security -> Access Permissions and Launch and Activation Permissions, enabled everything for the User 'Everyone'

This then allowed me to connect, but when It comes to read the server I get the following exception -

[System.Runtime.InteropServices.COMException] {"Exception from HRESULT: 0x80040202"} System.Runtime.InteropServices.COMException

I have scoured the web as much as I possibly can, and they all boil down to Dcom related issues. I have simply tried everything with the Dcom Settings. I have made sure the settings are enabled for both MyComputer and RSLinx server.


I am using two .dll files from OPCFoundation - **opcNetApi.dll , opcNetApi.Com.dll**



**Here is my code, (It may be handy)**

Code:
   private void readplc()
            {
                Opc.URL url = new Opc.URL("opcda://48.5.0.05/RSLinx OPC Server");
                Opc.Da.Server server = null;
                OpcCom.Factory fact = new OpcCom.Factory();
                server = new Opc.Da.Server(fact, null);
                try
                {
                    server.Connect(url, new Opc.ConnectData(new System.Net.NetworkCredential()));
                }
                catch (Exception exy)
                {
                    MessageBox.Show(exy.Message);
    
                }
                // Create a group
                Opc.Da.Subscription group;
                Opc.Da.SubscriptionState groupState = new Opc.Da.SubscriptionState();
                groupState.Name = "Group";
                groupState.Active = true;
                group = (Opc.Da.Subscription)server.CreateSubscription(groupState);
                // add items to the group.
                Opc.Da.Item[] items = new Opc.Da.Item[6];
                items[0] = new Opc.Da.Item();
                items[0].ItemName = "[ALARM]F20:9";
                items[1] = new Opc.Da.Item();
                items[1].ItemName = "[ALARM]F22:30";
                items[2] = new Opc.Da.Item();
                items[2].ItemName = "[ALARM]F22:6";
                items[3] = new Opc.Da.Item();
                items[3].ItemName = "[ALARM]F18:8";
                items[4] = new Opc.Da.Item();
                items[4].ItemName = "[ALARM]F22:32";
                items[5] = new Opc.Da.Item();
                items[5].ItemName = "[ALARM]F22:5";
                items = group.AddItems(items);
    
                try
                {
    
                    group.DataChanged += new Opc.Da.DataChangedEventHandler(OnTransactionCompleted); // COM EXCEPTION THROWN HERE
                    Console.ReadLine();
    
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Console.ReadKey();
                }
    
            }
    
    
    
    
            private void OnTransactionCompleted(object group, object hReq, Opc.Da.ItemValueResult[] items)
            {
    
                for (int i = 0; i < items.GetLength(0); i++)
                {

    
                }
    
            }


I know for certain that the code works as I have tried building the application connecting as a localhost on the PC I am trying to remote connect to, it reads the data happily.


Hopefully, someone will have some idea what is going on, I have spent over 12 hours in the last 4 working days trying to work it out!
 
This is exactly why new applications should be in OPC UA instead of OPC DA. DCOM settings are archaic black magic ********. Even though UA has been released for a decade and is superior in every way, I don't think Rockwell supports it directly, but you can throw more money at the problem and install a Kepware middle man. Alternatively, you will need to get Rockwell or Microsoft support involved to try and sort out you DCOM settings.
 
As I recall, DCOM settings never took effect until PC was power cycled. Even if my memory is faulty, it might be worth a try.
 
Hi, I'm a new member in this fórum and starting with client applications.

I´ve got 2 questions:

- What do you mean when saying "power cycling"?

- Is it mandatory to use OPC's when working (Data Reading) with PLC's? I'm trying to communicate an ERP (SAP MII) with siemens PLC's and CP 343, 443.

Thank you so much.
 
Use an OPC test client for testing the connection from the PC to the remote OPC server.

Just a wild guess, but does RSlinx possibly block DCOM ? I speculate so because for remote access Rockwell wants you to purchase RSLinx Gateway.

Apart from that Ignition has a free OPC UA server that works with Rockwell PLCs.
 
Hello,

>- What do you mean when saying "power cycling"?

When you change a DCOM setting you need to restart the computer. I found this to be true years ago. It might have changed on modern OSs but, I still restart.

> Is it mandatory to use OPC's when working

No. Many software products, like PeakHMI, have native drivers to access PLCs and support OPC, as a client, to provide a method to access a PLC if a native driver is not included. Also, acting as an OPC server is common.
 
>Is it mandatory to use OPC's when working

I managed to go about a 7 years without doing a single OPC connection (then had the misfortune of trying to link Factory Talk with a non-Rockwell PLC on several occasions). I did a lot of native driver stuff (B&R, Trio, Galil, misc. others) and ModbusTCP. I work almost exclusively with OEMs and OPC just doesn't come up very often on that side of the business. End users looking for historians and process guys are where most of the OPC work is.
 

Similar Topics

Folks, I have a client with an old ABB Advant / MOD300 system (v14.4). Around y2k I installed the ABB Industrial IT MOD300 OPC Server 1.1/2...
Replies
1
Views
185
TLDR: I try to establish the OPC communication between Kepware OPC DA Client to ABB 800xA OPC DA Server. In the Kepware OPC quick client of poll...
Replies
0
Views
855
hey guys. i am having an issue and maybe somebody here can help me out with it. i have a panelview plus that i am trying to get to read kepserver...
Replies
5
Views
3,484
Dear all, It's my first time configuring the cimplicity taking values from a remote Kepware OPC server on a Windows Server 2012 station. I have...
Replies
1
Views
4,823
Sorry about the title, it's hard to sum up my question in succinct enough form. In this system I'm designing, there will be a PC running OPC...
Replies
0
Views
1,560
Back
Top Bottom