VS2010调用OPCAutomation,报 System.AccessViolationException
各位好!
项目中遇到使用windowservice调用OPCAutomation时,调用OpcGroup.SyncRead方法错误,直接将windowservice关闭了。
访问受保护的内存?此时,重新启动服务,没办法启动,IOPCAutoServer.Connect联接失败。
持续6分钟后,可以启动OPC。
初始保存就是SyncRead方法报出来: System.AccessViolationException。
OPCServcer在本地,程序也在本地。
这个情况,该如何解决?
Framework 版本: v4.0.30319
说明: 由于未经处理的异常,进程终止。
异常信息: System.AccessViolationException
堆栈:
在 OPCAutomation.OPCItems.GetOPCItem(Int32)
在 ISS.Project.BLL.OPCClient.Read(System.String)
在 ISS.Project.BLL.Heart.ReadHeartMonitor(Int32)
在 AMESAVIServerNameSpace.AMESAVIServer.ReadHeartBeatHandle(System.Object, System.Timers.ElapsedEventArgs)
在 System.Timers.Timer.MyTimerCallback(System.Object)
在 System.Threading._TimerCallback.TimerCallback_Context(System.Object)
在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
在 System.Threading._TimerCallback.PerformTimerCallback(System.Object)
报文上边那个错之后,就报连接不上
AVIService System.Exception: System.Runtime.InteropServices.COMException (0x8000401A): 因为配置标识不正确,系统无法开始服务器进程。请检查用户名和密码。