Reputation: 21
I am using OpcNetApi.dll driver to connect Softing opc server and i am reading few tags from subscription read method every second in the windows service, Initially it reads the value fine for few hours like 10 or 15 hours but then i constantly getting this ReadMaxAge exception for each read, when i reboot the server it starts working correctly again for few hours. i tried searching to find what is causing but no luck.
Does anyone have idea about ReadMaxAge exception please help.
Upvotes: 0
Views: 503
Reputation: 13
So, I did long term test (6 days!) of OPC client written using OpcNetApi, connected to MatrikonOPC server for simulation, with result No crash at all. I've also check code of OpcNetApi! Exception is thrown from underlying COM object (and the details are not provided of course). At the moment I suspect that it crashed because OPC server itself was not running. I've added additional logging to my "production" application to verify my suspicion.
edit: There has been no crash related to "ReadMaxAge" so far (service is running for a week now). I would recommend you to verify that OPC server that you are connecting to is ONLINE when the exception occurs.
Upvotes: 0
Reputation: 61
In my instance its hold up to roughly 3 to 4 days continuously. When this happen restarting the service will work again. Currently i'm trying to let the service to auto restart when this happen. Obviously this something temporary to keep it going.
private void OpcServer_OPCError(string flags, Exception e)
{
logger.Error("OPC error: {error}", e.Message);
// Let OS to restart service
this.ExitCode = 1;
this.Stop();
}
Once the service exit with error, set the service recovery option as below; service recovery option
Upvotes: 0