各位前辈:
我正在用C#开发OPC Client 端,代码连接本机OPC Server 没有问题。连接远端OPC Server 一直报错,错误描述为:无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“OPC.IOPCServerList”。此操作失败的原因是对 IID 为“{13486D50-4821-11D2-A494-3CB306C10000}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))。这是什么意思?为什么会有此问题。
我开发OPC Client 使用的是OpcDANet.Dll运行到OpcServerBrowser opcSrvBrow = new OpcServerBrowser(info);出现
上述错误,可是OpcDANet.Dll提供的远端连接Sample是这样写的阿,为什么会这样?
各位大哥给点提示,都两天了,头大!远端连接代码为:
OPC.Common.Host info = new OPC.Common.Host();
info.HostName = "CDEFPG-141";
info.Password = "cimt";
info.UserName = "Administrator";
OpcServerBrowser opcSrvBrow = new OpcServerBrowser(info);//查找远端OPC Server
Guid srvGuid; //唯一标示
int guidRtc = opcSrvBrow.CLSIDFromProgID ("Matrikon.OPC.Simulation.1", out srvGuid);
if (HRESULTS.Succeeded(guidRtc))
{ OpcServer opcSrv = new OpcServer();
rtc = opcSrv.Connect(srvGuid); //连接OPC Server
//读写Item
}
我正在用C#开发OPC Client 端,代码连接本机OPC Server 没有问题。连接远端OPC Server 一直报错,错误描述为:无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“OPC.IOPCServerList”。此操作失败的原因是对 IID 为“{13486D50-4821-11D2-A494-3CB306C10000}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))。这是什么意思?为什么会有此问题。
我开发OPC Client 使用的是OpcDANet.Dll运行到OpcServerBrowser opcSrvBrow = new OpcServerBrowser(info);出现
上述错误,可是OpcDANet.Dll提供的远端连接Sample是这样写的阿,为什么会这样?
各位大哥给点提示,都两天了,头大!远端连接代码为:
OPC.Common.Host info = new OPC.Common.Host();
info.HostName = "CDEFPG-141";
info.Password = "cimt";
info.UserName = "Administrator";
OpcServerBrowser opcSrvBrow = new OpcServerBrowser(info);//查找远端OPC Server
Guid srvGuid; //唯一标示
int guidRtc = opcSrvBrow.CLSIDFromProgID ("Matrikon.OPC.Simulation.1", out srvGuid);
if (HRESULTS.Succeeded(guidRtc))
{ OpcServer opcSrv = new OpcServer();
rtc = opcSrv.Connect(srvGuid); //连接OPC Server
//读写Item
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货