12/14/2016
Exception caught. 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)
Only when using a none local opc server this exception happens!
When working with an OPC client not based on OPC.NET.API all is working fine, so I assume this is not a DCOM setting problem.
any ideas anyone?
Which "account" is your service running under? ("system" or other?)
Next, is that account specified within the DCOM configuration screens?
Does your application exist within the list of applications (within the DCOM configuration) and if so, did you configure it?
DCOM is always a pain and a constant cause of frustration, but we will get there!
10/05/2016
My configuration is somewhat different. I have written a web application that uses the opcnetapi component. Debugging it in Visual Studio works fine when the application is hosted on IIS Express. When hosted on full IIS it fails with the same error you are seeing above. Permissions are not a problem since I have set both versions of IIS to run as the same user with administrative privileges. I am connecting to two remote OPC servers successfully when hosted on IIS Express.
When you do an Advise, DCOM creates separate connections from the Server to the Client. For that scenario, the DCOM security settings on the Client node will be checked. I.e. a working connection between Client and Server does not imply that callbacks work.
The OPC Foundation created a DCOM configuration whitepaper for Interop Testing workshops which I will send you by eMail.
12/14/2016
Thanks Karl for the mail, but this is a know document for me.
But just to be sure I rechecked the Dcom settings and they are ok and Firewalls are disabled.
Did reboot of systems and test but still same error
just a reminder:
- I have none dotNet clients working fine on same systems with out problems
- only after the upgrade of the .Net API (installed was include with other software) I see this problem.
06/04/2019
I had this problem also and it drove me nuts for 2 weeks!
After cleaning up DCOM security access rights, I was able to connect to remote OPC server and I could even create the Subscription.
But when I tried to create the event handler for the DataChanged event on the subscription, I would always get the error described in post 1 of this thread.
Check Windows Event Viewer \ Windows Logs \ Security on the server machine.
If you are able to connect, you should see Audit Success messages when your client connects.
Now, look at that same log on the CLIENT. When you try to create the callback / event handler, the library is attempting to do that in the security context of the remote OPC Server. Mine was set to run as the SYSTEM account on my server, and I was getting Audit Failure messages on my client when trying to create the event handler. Looking into the event log, it was attempting a logon as SYSTEM.
My guess is that the SYSTEM account passwords on the 2 systems do not match and I do not know how to change that.
Solution was to create a local account on each machine for running the OPC Server which runs as a service. I used that security context for my OPC server connection from the client (credentials within the ConnectData object used for Server.Connect). This account is also configured for all the DCOM security stuff as found in numerous articles on the web. Of course, the Username and Password for these new accounts on each machine must match.
1 Guest(s)