使用OPC HDA Matrikon Wrapper DLL时出错 [英] Error while using the OPC HDA Matrikon Wrapper DLL
问题描述
我使用的是Matrikon的OPCHDAAuto.DLL,它是一个COM DLL。现在,我必须将项添加到服务器以便从中读取标记,并且有两个类 - OPCHDAServer和OPCHDAItems。 OPCHDAItems在OPCHDAServer类中定义。
使用代码关联它们的唯一方法是:
I am using the Matrikon's OPCHDAAuto.DLL and it is a COM DLL. Now, I have to add the item to the server so as to read tags from it and there are two classes - OPCHDAServer and OPCHDAItems. The OPCHDAItems is defined in the OPCHDAServer class. The only way to relate them using code is:
Dim items as OPCHDAItems
Dim items as OPCHDAItems
Dim server as OPCHDAServer = new OPCHDAServer()
Dim server as OPCHDAServer = new OPCHDAServer()
items = server.OPCHDAItems()
items = server.OPCHDAItems()
但这会引发我的错误:
System.InvalidCastException未处理
Message =" 无法将类型为'OPCHDAAutomation.OPCHDAServerClass'的对象强制转换为'OPCHDAAutomation.IOPCHDAItems'。"
Message="Unable to cast object of type 'OPCHDAAutomation.OPCHDAServerClass' to type 'OPCHDAAutomation.IOPCHDAItems'."
  Source =" Interop.OPCHDAAutomation"
不幸的是,我也尝试了所有其他方法 - 直接从OPCHDAItems调用add方法:
Unfortunately, I tried all other methods as well - calling add method directly from the OPCHDAItems using:
Dim items as OPCHDAItems
Dim items as OPCHDAItems
items.Add(" TagName",1)
items.Add("TagName",1)
但这会引发以下错误:
System.NullReferenceException未处理
Message =" 对象引用未设置为对象的实例。"
Message="Object reference not set to an instance of an object."
Source =" DAhda"
要解决此错误,我尝试了这个:
To rectify this error, I tried this:
Dim items as OPCHDAItems = new OPCHDAItems()
Dim items as OPCHDAItems = new OPCHDAItems()
items.Add(" TagName",1)但它会抛出一个COM错误:
items.Add("TagName",1) but it throws me a COM error:
System.Runtime.InteropServices.COMException未处理
ErrorCode = -2147221164
Message =" 由于以下错误,检索具有CLSID {0DF9ABBF-B4DC-11D4-9E6F-00B0D060205F}的组件的COM类工厂失败:80040154。"
Message="Retrieving the COM class factory for component with CLSID {0DF9ABBF-B4DC-11D4-9E6F-00B0D060205F} failed due to the following error: 80040154."
Source =" DAhda"
我想知道是否有人尝试过编写他们的HDA客户端,以及他们是否早些时候遇到任何此类问题。请帮我解决这个问题!
I was wondering if someone had tried writing their HDA client and if they faced any such issues earlier. Please help me resolve this!
推荐答案
嗨ZipsCoder,
Hi ZipsCoder,
此论坛处理与之相关的请求开放协议规范文档问题。 可在此处找到开放协议规范,
http:// msdn2。 microsoft.com/en-us/library/cc203350.aspx
This forum handles requests related to Open Protocols Specifications documentation issues. The Open Protocol Specifications can be found here, http://msdn2.microsoft.com/en-us/library/cc203350.aspx
您的问题似乎与开放协议规范文档集无关。
Your question does not appear to be related to the Open Protocols Specifications documentation set.
您可以联系供应商获取"OPC HDA Matrikon Wrapper",
http://www.matrikonopc.com/opc-ua/products/ua-wrapper-com-opc-servers.aspx
You may want to contact the vendor for the "OPC HDA Matrikon Wrapper", http://www.matrikonopc.com/opc-ua/products/ua-wrapper-com-opc-servers.aspx
和/或,浏览供应商常见问题解答,
http:// www。 opcfoundation.org/Default.aspx/forum/index.asp
And/Or, browse the vendor FAQs for an answer, http://www.opcfoundation.org/Default.aspx/forum/index.asp
此外,可能有人在Visual C#常规论坛上提供帮助,
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread s /
Also, possibly, someone at the Visual C# General forum could help, http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/threads/
问候,
Mark Miller |升级工程师| Microsoft开放协议支持
Mark Miller | Escalation Engineer | Microsoft Open Protocol Support
这篇关于使用OPC HDA Matrikon Wrapper DLL时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!