【发布时间】:2013-08-14 16:12:51
【问题描述】:
我在 Visual Studio 2012 中使用 OPC Foundation .NET API。当我尝试连接时,我收到此错误:
无法将“OpcCom.Factory”类型的对象转换为“Opc.IFactory”类型
...在此代码中的指令new Opc.Da.Server(:
private void button1_Click(object sender, EventArgs e)
{
Opc.Da.Server plcServer = null;
string serverUrl = "opcda://localhost/RSLinx OPC Server";
plcServer = new Opc.Da.Server(new OpcCom.Factory(), new Opc.URL(serverUrl));
plcServer.Connect();
}
【问题讨论】: