When calling IAlarmClient.GetAlarmLines inside an Event Server background plugin in 2023R3 using latest NuGet packages, the method throws an exception.
IAlarmClient alarmClient = LookupAlarmClient(EnvironmentManager.Instance.MasterSite);
var allNewAlarms = alarmClient.GetAlarmLines(0, MAX_ALARM_LINES, new VideoOS.Platform.Proxy.Alarm.AlarmFilter()
{
Orders = new OrderBy[] { new OrderBy() { Order = Order.Descending, Target = Target.Timestamp } },
Conditions = new Condition[]
{
new Condition() { Value = 1, Target = Target.State, Operator = Operator.Equals },
},
});
var allInProgressAlarms = alarmClient.GetAlarmLines(0, MAX_ALARM_LINES, new VideoOS.Platform.Proxy.Alarm.AlarmFilter()
{
Orders = new OrderBy[] { new OrderBy() { Order = Order.Descending, Target = Target.Timestamp } },
Conditions = new Condition[]
{
new Condition() { Value = 4, Target = Target.State, Operator = Operator.Equals },
},
});
2024-03-25 23:53:52.158+01:00 [ 7] ERROR - InviTHINGSPlugin.MyTimerCallback Error System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://ms-demo:22331/Central/AlarmService2. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. —> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. —> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. —> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
— End of inner exception stack trace —
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
— End of inner exception stack trace —
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
— End of inner exception stack trace —
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IAlarmCommand.GetAlarmLines(Int32 from, Int32 maxCount, AlarmFilter filter)
at VideoOS.Platform.Proxy.AlarmClient.AlarmClientCredentials.GetAlarmLines(Int32 from, Int32 maxCount, AlarmFilter filter)
at InviThingsXProtect.Background.AlarmManager.A(Object , ElapsedEventArgs )
I have checked this thread and installed latest Event Server hotfix, no change.