Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Connect remote server with credentials

More
30 Jul 2017 16:51 #5382 by support
The proper way of addressing a remote OPC-DA server is with the lines you have actually commented out.

You *cannot* provide credentials. That has to be done outside the program - by configuring the account under which your process runs, and configuring the Windows/domain and DCOM security accordingly. The NetworkSecurity in ServerDescriptor is for OPC XML-DA only.

The proper scheme would be "opcda:" in case of URL syntax, but it is not used when you revert back to the lines you have commented out, as I suggested.

Best regards

Please Log in or Create an account to join the conversation.

More
18 Jul 2017 06:48 #5370 by qiuyujx5
I'm trying to connect a remote simulation server with an 64-bit based console app. My current code is as follows:
EasyDAClient client = new EasyDAClient();
Console.WriteLine("Reading item test...");
EasyDAClient.SharedParameters.ClientParameters.UseCustomSecurity = true;
 
NetworkSecurity networkSecurity = new NetworkSecurity(UserName, Password, MachineName);
ServerDescriptor serverDescriptor = new ServerDescriptor("\\\\xxx.xxx.xxx.xxx\\Matrikon.OPC.Simulation.1", networkSecurity);
serverDescriptor.Scheme = "http"; // this does not work no matter what scheme I tried
DAItemDescriptor itemDescriptor = new DAItemDescriptor();
 
Console.WriteLine(client.ReadItemValue(serverDescriptor, itemDescriptor));

(UserName, Password, MachineName) are constants where "MachineName" is exactly same as "xxx.xxx.xxx.xxx" specified in constructor of server descriptor.

There are 6 inner exceptions shown as follows:

1/6
NetApiException: An exception occurred during processing in a NET API OPC Data Access client. The inner exception contains details about the problem.

2/6
NetApiException: An exception occurred during processing in a NET API OPC Data Access client. The inner exception contains details about the problem.

3/6
ResultIDException: E_FAIL

E_NETWORK_ERROR

Could not connect to server.

4/6
ConnectFailedException: E_NETWORK_ERROR

Could not connect to server.

5/6
WebException: Unable to connect to the remote server

6/6
SocketException: No connection could be made because the target machine actively refused it

I also tried other scheme such as "opc.tcp" and without scheme (this seems to be automatically recognized as "file" scheme), none of them works.

Any help will be appreciated.

Please Log in or Create an account to join the conversation.

More
18 Jul 2017 06:36 #5369 by qiuyujx5
Any help will be appreciated!

I have a simulation server running remotely, and now I want to write a console app on 64-bit based Win8.1 to read item values, but I can't successfully connect to the server.

Because the server is running remotely, and there is a credentials of the machine, so that I can't simply use the sample code. Instead, my code is as follows:
            EasyDAClient client = new EasyDAClient();
            Console.WriteLine("Reading item test...");
            EasyDAClient.SharedParameters.ClientParameters.UseCustomSecurity = true;
 
            NetworkSecurity networkSecurity = new NetworkSecurity(UserName, Password, MachineName);
            ServerDescriptor serverDescriptor = new 
            ServerDescriptor("\\\\xxx.xxx.xxx.xxx\\Matrikon.OPC.Simulation.1", networkSecurity);
            serverDescriptor.Scheme = "http"; // this does not work no matter what scheme I tried
            DAItemDescriptor itemDescriptor = new DAItemDescriptor();
 
            //Console.WriteLine(client.ReadItemValue("localhost1", DefaultProgID, DefaultItemID));
            //Console.WriteLine(client.ReadItemValue(MachineName, CLSID, ItemID));
            Console.WriteLine(client.ReadItemValue(serverDescriptor, itemDescriptor));

UserName, Password, MachineName are constants where MachineName is exactly same as xxx.xxx.xxx.xxx in ServerDescriptor constructor

I've tried server descriptor without scheme (this will be recognized as "file" scheme), with "opc.tcp", with "http" and they all do not work.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.069 seconds