Exception: RPC Server is Unavailable with DataChanged Handler|Classic OPC: DA, A&E, HDA, XML-DA, etc.|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Exception: RPC Server is Unavailable with DataChanged Handler
Avatar
LeeN
New Member
Members
Forum Posts: 1
Member Since:
03/19/2024
sp_UserOfflineSmall Offline
1
04/11/2024 - 22:24
sp_Permalink sp_Print

I have a Windows Service with .NET Framework 4.8 which connects to an OPC-DA server (Wonderware OI.GATEWAY).  I have installed the latest Nuget packages for OpcNetApi, OpcNetApi.Com, and OpcNetApi.Xml.

I'm able to connect to the Opc.Da.Server just fine and read an ItemValueResult.Value returned from a simple test ItemIdentifier.

The following exception is thrown when I attempt to register a delete event handler method on DataChanged (line of code which causese the exception to be thrown shown first).  My goal is to subscribe to a list of tags and fire a delegate method on DataChanged.

group.DataChanged += new Opc.Da.DataChangedEventHandler(onDataChange);

System.Runtime.InteropServices.COMException: 'The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)'

This exception was originally thrown at this call stack:
OpcCom.ConnectionPoint.Advise(object)
OpcCom.Da.Subscription.Advise()
OpcCom.Da.Subscription.DataChanged.add(Opc.Da.DataChangedEventHandler)
Opc.Da.Subscription.DataChanged.add(Opc.Da.DataChangedEventHandler)
HistorianDataForwarder.Services.OPCDAService.AddSubscription(string, System.Collections.Generic.List<string>, HistorianDataForwarder.Services.OPCDAService.DataChangedEventHandler) in OPCDAService.cs
HistorianDataForwarder.ForwarderService.ConnectOPC() in ForwarderService.cs

 

I'd appreciate any help, thanks!

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
04/20/2024 - 05:42
sp_Permalink sp_Print

This is usually a permission problem.

DCOM requires that the Server have rights to connect to the Client machine which can be a challenge to configure.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 32
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855