01/31/2018
I have a basic subscription and it works fine on my development computer. But for the life of me I am unable to deploy it to a server. When I run the application it throws an error on this specific line of code (highlighted in red):
Note: I have OPC Core Components Redistributable x64 3.0.107.24 installed.
groupState = new Opc.Da.SubscriptionState();
groupState.Name = "Group";
groupState.Active = true;
group = (Opc.Da.Subscription)opcServer.CreateSubscription(groupState);
group.DataChanged += new Opc.Da.DataChangedEventHandler(OnTransactionCompleted);
I get a System.NullReferenceException: Object reference not set to an instance of an object.
I will get a COMException during runtime.
System.Runtime.InteropServices.COMException (0x80040202): Exception from HRESULT: 0x80040202.
at OpcRcw.Comn.IConnectionPoint.Advise(Object pUnkSink, Int32& pdwCookie)
at OpcCom.ConnectionPoint.Advise(Object callback)
at OpcCom.Da.Subscription.Advise()
at OpcCom.Da.Subscription.add_DataChanged(DataChangedEventHandler value)
at Opc.Da.Subscription.add_DataChanged(DataChangedEventHandler value)
at BackFlush_POC.myOPC.connectOPC()
The same exact .exe run on my dev computer works with no issues.
Has anyone seen something like this? I've been struggling with this for days. Thanks.
05/30/2017
This a common DCOM configuration issue.
With OPC COM the firewalls on the client machine must be opened to all the server to access the client process.
If there is a problem with DCOM configuration you get the '0x80040202' error.
Search for OPC and that error code to find resources.
1 Guest(s)