来源:https://pisquare.osisoft.com/message/13441

A failuare of generating OSIDAAuto.OPCServer

dorisliper 2011-2-17 上午2:13

Dear Sir/Madam

We'd like to use OSIDAAuto.OPCServer, but an exception occurs as follows when we generate OSIDAAuto.OPCServer. "error message:the following error occurred:80040154 when obtaining the COM class factory of component including CLSID{25E4451E-DA6A...}" We think that registering COM componet is done well, because the same key exists in the registry. Please let me know if you know another reason.

Environment OS:Windows Server Enterprise SP2 (64Bit)
developing tool:Visual Studio 2008(VB.NET / 3.5SP1) 
Source Code

Dim myOPCServer AS OSIDAAuto.OPCServer = new OSIDAAuto.OPCServer()

Sincerely yours, Yamaguchi

  • 127 查看
  • 标签: opc_da
    带有 opc_da 标记的内容
平均用户评级: 无评分 (0 评级)

平均用户评级
无评分
(0 评级)
  • Re: A failuare of generating OSIDAAuto.OPCServer

    hanyong  2011-2-17 上午5:59 (回复 dorisliper

    Hi Yamaguchi,

    I guess you are trying to write an OPC client that reads data from PI Server via PI OPC DA Server? Have you tried connecting to PI OPC Server using PI OPC Client or other 3rd party OPC client from the development machine? Is the PI Server on the same machine?

    • Re: A failuare of generating OSIDAAuto.OPCServer

      spilon 2011-2-17 上午8:22 (回复 hanyong

      Is your application (the OPC Client) on the same machine than the PI OPC DA/HDA Server? I'm asking because it might very well be a DCOM security issue... I would kindly recommend you read the section on security and DCOM in the PI OPC DA/HDA Server manual (available on the vCampus Library, under vCampus PI Products Kit > Data Access Technologies).

      • Re: A failuare of generating OSIDAAuto.OPCServer

        dorisliper 2011-2-22 下午3:02 (回复 spilon

        Han san, Steve san,

        Thank you so much for your answer.

        The same error is displayed when the component generation is done though I set the DCOM while seeing the

        taught manual.

        PI Server, PI OPC Server and the program to be executed are in the same host.

        The thing I was anxious when I saw the manual is below.

        "It should be Windows 2000/XP.

        Although there are costomers who operate with Windows2003, that is not examined formally."

        Is it OK that we are testing in Windows2008(64bit)?

        In the manual, there is a descripition of using PISDK in PI OPC Server,too.

        Is there a condition that it's necessary to generate PI SDK before OPC server is generated?

        The source code is the following.

        Please teach if there is a code problem.

        1. Imports OSIDAAuto
        2. '''
        3. ''' Test Program
        4. '''               Watch Tag
        5. '''
        6. '''
        7. ''' +-------------+    +----------------------+    +--------------+    +-----------+
        8. ''' | ClsWatchOPC | -> |OSIsoft.OSIDAAuto.dll | -> | PI OPC Server| -> | PI Server |
        9. ''' +-------------+    +----------------------+    +--------------+    +-----------+
        10. '''
        11. Public Class ClsWatchOPC
        12. Protected _OPCServer As OPCServer
        13. Protected _OPCGroups As OPCGroups
        14. Protected WithEvents _OPCGroup As OPCGroup
        15. Protected _OPCItems As OPCItems
        16. Protected _OPCItem As OPCItem
        17. Public Const ITEM_MAX As Integer = 8
        18. Public ItemName(ITEM_MAX) As String
        19. Public HandleClient(ITEM_MAX) As Integer
        20. Public HandleServer(ITEM_MAX) As Integer
        21. Public oVal(ITEM_MAX) As Object
        22. Public dTime(ITEM_MAX) As Date
        23. Public wQuality(ITEM_MAX) As Short
        24. Private Sub New()
        25. Dim ServerHandles As Array = Nothing
        26. Dim Errors As Array = Nothing
        27. ' Create OPCServer and Connect
        28. Debug.WriteLine("Start : Create OPCServer")
        29. _OPCServer = New OPCServer()
        30. _OPCServer.Connect("OSI.DA.1")
        31. Debug.WriteLine("  End : Create OPCServer")
        32. ' Setting Update Rate   1000[ms]
        33. Debug.WriteLine("Start : Setting Update Rate")
        34. _OPCGroups = _OPCServer.OPCGroups
        35. _OPCGroup = _OPCGroups.Add("Group1")
        36. _OPCGroup.UpdateRate = 1000
        37. Debug.WriteLine("  End : Setting Update Rate")
        38. ' Enable Advise Function
        39. Debug.WriteLine("Start : Enable Advise Function")
        40. _OPCGroup.IsActive = True
        41. _OPCGroup.IsSubscribed = _OPCGroup.IsActive
        42. Debug.WriteLine("  End : Enable Advise Function")
        43. ' Setting Watch Tag(TAG1 ~ TAG8)
        44. Debug.WriteLine("Start : Setting Watch Tag")
        45. _OPCItems = _OPCGroup.OPCItems
        46. For i As Integer = 1 To ITEM_MAX
        47. ItemName(i) = "TAG" & i
        48. HandleClient(i) = i
        49. Next
        50. _OPCItems.AddItems( _
        51. ITEM_MAX _
        52. , ItemName _
        53. , HandleClient _
        54. , ServerHandles _
        55. , Errors _
        56. )
        57. For i As Integer = 1 To ITEM_MAX
        58. If Errors(i) = 0 Then
        59. HandleClient(i) = ServerHandles(i)
        60. Debug.WriteLine( _
        61. "ItemName[" _
        62. & i _
        63. & "] : Regist Success." _
        64. )
        65. Else
        66. Debug.WriteLine( _
        67. "ItemName[" _
        68. & i _
        69. & "] : Regist Failure." _
        70. )
        71. End If
        72. Next
        73. Debug.WriteLine("  End : Setting Watch Tag")
        74. End Sub
        75. Private Sub OPCGroup_DataChange( _
        76. ByVal TransactionID As Integer _
        77. , ByVal NumItems As Integer _
        78. , ByRef ClientHandles As System.Array _
        79. , ByRef ItemValues As System.Array _
        80. , ByRef Qualities As System.Array _
        81. , ByRef TimeStamps As System.Array _
        82. ) Handles _OPCGroup.DataChange
        83. Debug.WriteLine("DataChanged")
        84. Debug.WriteLine("TransactionID : [" & TransactionID & "]")
        85. Debug.WriteLine("NumItems : [" & NumItems & "]")
        86. For i As Integer = 1 To NumItems
        87. Debug.WriteLine( _
        88. "Rec[" & i & "] : " _
        89. & "ItemValues : [" & ItemValues(i) & "]" _
        90. & " / Qualities : [" & Qualities(i) & "]" _
        91. & " / TimeStamps : [" & TimeStamps(i) & "]" _
        92. )
        93. Next
        94. End Sub
        95. Private Sub OPCGroup_AsyncReadComplete( _
        96. ByVal TransactionID As Integer _
        97. , ByVal NumItems As Integer _
        98. , ByRef ClientHandles As System.Array _
        99. , ByRef ItemValues As System.Array _
        100. , ByRef Qualities As System.Array _
        101. , ByRef TimeStamps As System.Array _
        102. , ByRef Errors As System.Array _
        103. ) Handles _OPCGroup.AsyncReadComplete
        104. Debug.WriteLine("AsyncReadComplete")
        105. Debug.WriteLine("TransactionID : [" & TransactionID & "]")
        106. Debug.WriteLine("NumItems : [" & NumItems & "]")
        107. For i As Integer = 1 To NumItems
        108. Debug.WriteLine( _
        109. "Rec[" & i & "] : " _
        110. & "ItemValues : [" & ItemValues(i) & "]" _
        111. & " / Qualities : [" & Qualities(i) & "]" _
        112. & " / TimeStamps : [" & TimeStamps(i) & "]" _
        113. )
        114. Next
        115. End Sub
        116. Private Sub OPCGroup_AsyncWriteComplete( _
        117. ByVal TransactionID As Integer _
        118. , ByVal NumItems As Integer _
        119. , ByRef ClientHandles As System.Array _
        120. , ByRef Errors As System.Array _
        121. ) Handles _OPCGroup.AsyncWriteComplete
        122. Debug.WriteLine("AsyncWriteComplete")
        123. Debug.WriteLine("TransactionID : [" & TransactionID & "]")
        124. Debug.WriteLine("NumItems : [" & NumItems & "]")
        125. End Sub
        126. Private Sub OPCGroup_AsyncCancelComplete( _
        127. ByVal CancelID As Integer _
        128. ) Handles _OPCGroup.AsyncCancelComplete
        129. Debug.WriteLine("AsyncCancelComplete")
        130. Debug.WriteLine("CancelID : [" & CancelID & "]")
        131. End Sub
        132. End Class
        • Re: A failuare of generating OSIDAAuto.OPCServer

          spilon 2011-2-23 下午6:28 (回复 dorisliper

          What you seem to be using is a .NET Interop assembly that was automatically generated from the COM-based OPC Automation Interfaces we ship with our products. I personally do not have experience with using these "wrappers" and we actually never encouraged or taught how to use them.

          Typically, when you want to develop something OPC in .NET, you need to use the OPC .NET Automation Wrapper or the OPC .NET API. The former is intended to facilitate porting existing VB6 applications over to VB.NET, whereas the latter is the recommended approach for new OPC applications in .NET (whether in VB.NET or C#). For more information, please see the "OPC - Past, Present and Future" webinar under the vCampus Auditorium, or the PI Application Development Training course materials.

          Hope this helps!

          • Re: A failuare of generating OSIDAAuto.OPCServer

            spilon 2011-2-24 下午1:29 (回复 spilon

            Would you happen to be on a 64-bit machine? I dug this up a little more, and the Class ID you listed up there (at the least the 14 first characters) seem to point to the OSIDAAuto.dll COM library. This is a 32-bit library. You will have to force your .NET application to build for 32-bit because 64-bit stuff cannot call 32-bit DLLs.

            • Re: A failuare of generating OSIDAAuto.OPCServer

              spilon 2011-2-24 下午4:28 (回复 spilon

              Out of curiosity, I tried to make this code you posted earlier, but could not. I get past the creation of the OPCServer, but cannot seem to access/initialize the OPCGroups collection. After doing some research, it the seems like there is a problem in how .NET Interop was generated and how it deals with the underlying COM components. It seems like you can use it in the .NET Framework 1.1, but not in later version (like 3.5, which you are using). I found several other posts on forums on the Web, where people shared the same issue (for different OPC Servers, not OSIsoft's) and nobody found an answer.

              Per one of my previous posts, this library you are using is not something "official" or even supported. I strongly recommend you use one of the official alternatives:

              • OPC DA Automation Wrapper (also known as the "OPC .NET RCWs MergeModule")
              • OPC .NET API (they have version 1.3 for .NET 1.0/1.1, and version 2 for .NET 2.0)
              • OPC .NET 3.0 (a WCF-based SDK, formerly known as OPC Xi)

              Hope this helps!

生成OSIDAAuto.OPCServer失败的更多相关文章

  1. pyinstaller生成exe文件失败

    我的python是3.6,目前pyinstaller并不支持,有网友建议在Github上下载源码,用pyinstaller_develop文件夹替换pyinstaller安装位置下同名文件夹.这样做之 ...

  2. 安卓---下拉刷新---上拉加载---解决导入library等自生成库文件失败的问题

    本文的下拉刷新以及上拉加载都是用PullToRefresh实现的,关于PullToRefresh的介绍以及源码,网上可以找到很多,本人在此不再赘述. PullToRefresh是一套实现非常好的下拉刷 ...

  3. cmake利用toolchain.cmake生成makefile之后,make生成静态库失败问题

    问题描述 利用toolchian.cmake设置好编译器后,利用make指令生成静态库,出现以下问题 Error running link command: No such file or direc ...

  4. 关于ATL生成COM注册失败解决方法

    最近搞C++封装研究了下COM 做最后整理打包的时候发现各种问题引发的注册失败,so整理下备忘. 1.因引用其它动态连接库与你注册的dll不在同一目录下引起的异常.(解决方法将依赖dll放置与注册dl ...

  5. django中对数据库生成记录操作失败

    在终端执行以下语句时,会发现一点效果也没有,但是在manage.py中会成功: python3 manage.py makemigrations # 仅仅是在小本本上(migrations文件夹)记录 ...

  6. 比较详细PHP生成静态页面教程

    一,PHP脚本与动态页面. PHP脚本是一种服务器端脚本程序,可通过嵌入等方法与HTML文件混合, 也可以类,函数封装等形式,以模板的方式对用户请求进行处理.无论以何种方式,它的基本原理是这样的.由客 ...

  7. asp.net等项目编译失败的原因之不能写入

    本人遇到过一次生成mvc4项目失败,说是不能写入,后发现是权限问题,特此记录. 解决方案: 对C盘下的temp文件夹设置当前用户的写入权限即可.

  8. Android 下用 Pull 解析和生成 XML

    Java 中是可以用 SAX 和 DOM 解析 XML  的,虽然在 Android 下也可以用这2中方式,但是还是推荐用 Pull.Pull 使用简单,效率相对高,Android 下是集成了 Pul ...

  9. PHP代码为什么不能直接保存HTML文件——>PHP生成静态页面教程

    1.server会依据文件的后缀名去进行解析,假设是HTML文件则server不会进行语法解析.而是直接输出到浏览器. 2.假设一个页面中所有都是HTML代码而没有须要解析的PHP语法,则没有必要保存 ...

随机推荐

  1. 如何让你的 React Native 应用在键盘弹出时优雅地响应

    原文地址:How to make your React Native app respond gracefully when the keyboard pops up 原文作者:Spencer Car ...

  2. 一个跳转提示页面---JS

    //一个跳转提示页面   <script type="text/javascript">   var s=5;     function go(){        do ...

  3. TCP三次握手及释放连接详解(转)

    一.TCP头部简介 ACK :即确认字符,在数据通信中,接收站发给发送站的一种传输类控制字符.表示发来的数据已确认接收无误.TCP报文格式中的控制位由6个标志比特构成,其中一个就是ACK,ACK为1表 ...

  4. v$、v_$、gv$之间的关系

    本次实验测试,oracle数据库视图中v$,v_$,gv$之间的关系 总结: v_$是动态性能视图,通过sql查询数据库基表返回记录.例如,v_$database对象是视图类型,可对其它用户授权访问: ...

  5. Unity 3D-AR开发-Vuforia教程手册

    Unity 开发AR之 Vuforia 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar - ...

  6. 微信导出群记录V3.0

    一.序 导出东北师范大学2017级软件工程微信群的聊天记录,形式不限,但需要包含文字.图片和链接,不允许截图. 聊天记录的时间段为2017年11月3日12:00起至2018年1月3日12:00. 二. ...

  7. 2017.4.7 Sprng MVC工作流程描述图

    图一: 图二: Spring工作流程描述         1. 用户向服务器发送请求,请求被Spring 前端控制Servelt DispatcherServlet捕获:       2. Dispa ...

  8. 03 事务,连接池DBCP,C3P0,DBUtils

    事务 Transaction  其实指的一组操作,里面包含许多个单一的逻辑.只要有一个逻辑没有执行成功,那么都算失败. 所有的数据都回归到最初的状态(回滚) 事务的作用:为了确保逻辑的成功. 例子: ...

  9. WINDOWS系统的正确安装-硬盘格式如何选择

    有一种这样的说法,WIN7改装WIN10必须要重新分区,将硬盘格式化为GPT格式(GUID分区表 ), WIN10改装WIN7必须要重新分区,将硬盘格式化为MBR格式. 这种说法一直困扰着我,于是经过 ...

  10. PowerDesigner ---- 数据库设计(物理模型CDM和概念模型PDM)

    前言 上一篇介绍了个PowerDesigner工具的安装和汉化,现在我就说一下怎么用这个PowerDesigner建数据库吧.   内容 第一种方法:概念模型转物理模型 1.首先新建模型--选择概念模 ...