我正在使用带有 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();
}