我在使用标准 opc da 连接和浏览我的 opc 服务器时遇到问题。这是我创建的用于处理连接和浏览数据的类:
public class OPCDAClient {
private OpcDaServer Server = null;
private OPCClientSettings Settings;
private List<IOPCClientListener> Listeners = new List<IOPCClientListener>();
public OPCDAClient() { }
public OPCDAClient(OPCClientSettings settings) {
Settings = settings;
Server = new OpcDaServer(settings.Endpoint);
Server.Connect();
}
public void Browse() {
IOpcDaBrowser browser = new OpcDaBrowserAuto(Server);
OpcDaBrowseElement[] elements = browser.GetElements(null);
foreach(OpcDaBrowseElement element in elements) {
Console.WriteLine("Name: {0}, Has child: {1}", element.Name);
}
}
}
我在控制台中遇到的第一个错误Server.Connect()
如下:System.Runtime.InteropServices.ExternalException (0x80040154): CoCreateInstanceEx: Class not registered at TitaniumAS.Opc.Client.Interop.System.Com.CreateInstance(Guid clsid, String host, NetworkCredential credential) at TitaniumAS.Opc.Client.Interop.System.Com.CreateInstanceWithBlanket(Guid clsid, String host, NetworkCredential credential, ComProxyBlanket comProx)...
(编辑:由第一个错误引起)第二个错误在Browse()
函数中引发OpcDaBrowseElement[] elements = browser.GetElements(null);
。错误看起来像这样:System.AggregateException: 'no configuration section <common/logging> found - suppres(Browser isn't attached to com object.)'
。
我正在关注此处找到的 GitHub 上的库文档。我不明白我应该如何从这里继续。