Reputation: 388
I am trying to connect remote OPC server from client using C#. I got Interop.OpcAutomation.dll from OPC foundation and it worked very nicely with local opc server, but when comes to connect remote opc server it somehow shows Access denied (HRESULT: 0x80070005 (E_ACCESSDENIED)).
Here is code:
this._reqServer = new OPCServer();
this._reqServer.Connect("OPC.SimaticNET.1", "MachineName"); //Here it throws exception
So here what I already tried:
So anyone has tried to make some C# client which can access remote opc server, Please tell what more needs to done??
Upvotes: 1
Views: 7673
Reputation: 1
My way is to grant access to the server to a local group, create a user on the server side and define this user as a member of the local group I created. After I create the same user in the client machine with the same password I use in the server side. Adjust ALL DCOM permissions, reboot and try tô connect. Don't forget, do not use NAT anywhere.
Upvotes: 0
Reputation: 131
+1 for ambassallo's answer. I have two servers (Win Server 2016 servers) on two different connected networks. One server is on a domain and the other is stand-alone. I have an OPC-DA connection set up between them. The only way to get them to connect (after setting all DCOM, OPCEnum, etc and dropping the firewalls is to log into both machines as the same Windows user (local user on each server) and then connecting the client to the server.
Upvotes: 0
Reputation: 970
Create a local user on your computer that has the same user name and password as the one on the server. Right click on visual studio and do a run as using that user.
Upvotes: 1