Home > Net >  OpcNetApi not registered classes
OpcNetApi not registered classes

Time:09-27

URL URL=new URL (" opcda://127.0.0.1 Knight, OPC Server. The Demo ");
OpcCom. Factory fa=new OpcCom. Factory (false);
Opc. Da. The Opc Server m_server_two=new. Da. The Server (fa, url);
M_server_two. The Connect ();
Code as above, a total of two projects, the project 1 is winfrom program, click on the normal connection using the
Project 2 is a Windows service application has not been registered error
: Opc. ConnectFailedException: E_NETWORK_ERROR
Could not connect to server. - & gt; System. The Runtime. InteropServices. ExternalException: CoCreateInstanceEx: no register class
In OpcCom. Interop. CreateInstance (Guid clsids, String hostName, NetworkCredential credential)
In OpcCom. Factory. Connect (URL URL, ConnectData ConnectData)
- at the end of the inner exception stack trace -- -- --
. The Opc Server. The Connect (URL URL, ConnectData ConnectData)
... The Opc Da Server Connect (URL URL, ConnectData ConnectData)
. The Opc Server. The Connect ()

Two projects of configuration, are x86

CodePudding user response:

The same environment?
The same machine 2 application?

CodePudding user response:


reference 1st floor is nu month god reply:
environment?
The same machine 2 application?


Yes, on the same computer programs, code structure, same winfrom is triggered by a button click, another is to start after a direct connection, only this,.net version is 4.7.2
  •  Tags:  
  • C#
  • Related