Retrieve Error when using GetSystemCameras()

Dear team,

We have using following coding to retrieve camera list from milestone

 public List<Cameraes> GetSystemCameras()

{

  if (LoginInfo?.Token == null)

    return new List<Cameraes>();

  switch (AuthenticationType)

  {

    case AuthenticationType.Basic:

      \_basicConnection.GetConfiguration(LoginInfo.Token);

      if (ServerType == ServerType.C\_Code)

        return ExtractCameraDataFrom(\_basicConnection.ConfigurationInfo\_CServer);

      else

        return ExtractCameraDataFrom(\_basicConnection.Configuration\_EServer);

    case AuthenticationType.Windows:

    case AuthenticationType.WindowsDefault:

      \_ntlmConnection.GetConfiguration(LoginInfo.Token);

      if (ServerType == ServerType.C\_Code)

        return ExtractCameraDataFrom(\_ntlmConnection.ConfigurationInfo\_CServer);

      else

        return ExtractCameraDataFrom(\_ntlmConnection.Configuration\_EServer);

    default:

      return new List<Cameraes>();

  }

}

and got the following error message from server

The maximum message size quota for incoming messages (1000000) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element

We are using AuthenticationType.Windows type and error would be come from

_ntlmConnection.GetConfiguration(LoginInfo.Token);

Please advice if we need to change the configuration in milestone or any other advice, thx.

KennethT

Please test using the TCPVideoViewer. Do you see the same issue using the sample?

When you look at the protocol samples in the MIP SDK they use the ServerCommandWrapper.

Looking at NtlmConnection.cs you see in line 91:

MaxReceivedMessageSize = 1000000

Please try to increase this value. I am assuming that you will have based your integration on the sample, if you do not have the same code I still assume it is so much similar that you will be able to do the same modification in your code.

Is this a very large system? Please outline how big this system is in approximate numbers of recording servers and camera devices.

Can the Smart Client login using the same user on the same PC? Does it use extraordinary / unusual long time loading?

Even if the tip above solves the issue for you please let me have the feedback as I would have thought that even very large systems would not have an issue with the size limit implemented by this. Your feedback will be appreciated.

Dear Rie,

We can’t using TCPVideoViewer as that the our client production environment.

It is contain over 30 recording server and 4000+ camera devices. Smart client could be login successful and retrieve the camera list normally in same PC.

we will try to adjust the value as your mention at above and try again. We will update you if there have any outstanding issue after we try, thank a lot!

KennethT

When I create WCF channels in MilestonePSTools, I’m creating the bindings in code and here’s what it looks like. I’m not sure if it helps you in this case, but it shows all the timeouts/maximums that have been working well so far.

public static System.ServiceModel.Channels.Binding CreateBinding(bool isBasic)
{
    if (isBasic)
    {
        return new BasicHttpBinding
        {
            ReaderQuotas = XmlDictionaryReaderQuotas.Max,
            MaxReceivedMessageSize = ChannelSettings.MaxReceivedMessageSize,
            MaxBufferSize = ChannelSettings.MaxBufferSize,
            MaxBufferPoolSize = ChannelSettings.MaxBufferPoolSize,
            HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
            MessageEncoding = WSMessageEncoding.Text,
            TextEncoding = Encoding.UTF8,
            UseDefaultWebProxy = true,
            AllowCookies = false,
            Security =
            {
                Mode = BasicHttpSecurityMode.Transport,
                Transport = {ClientCredentialType = HttpClientCredentialType.Basic}
            },
            OpenTimeout = ChannelSettings.Timeouts.OpenTimeout,
            CloseTimeout = ChannelSettings.Timeouts.CloseTimeout,
            ReceiveTimeout = ChannelSettings.Timeouts.ReceiveTimeout,
            SendTimeout = ChannelSettings.Timeouts.SendTimeout
        };
    }
 
    return new WSHttpBinding
    {
        OpenTimeout = ChannelSettings.Timeouts.OpenTimeout,
        CloseTimeout = ChannelSettings.Timeouts.CloseTimeout,
        ReceiveTimeout = ChannelSettings.Timeouts.ReceiveTimeout,
        SendTimeout = ChannelSettings.Timeouts.SendTimeout,
        ReaderQuotas = XmlDictionaryReaderQuotas.Max,
        MaxReceivedMessageSize = ChannelSettings.MaxReceivedMessageSize,
        MaxBufferPoolSize = ChannelSettings.MaxBufferPoolSize,
        Security =
        {
            Message =
            {
                ClientCredentialType = MessageCredentialType.Windows
            }
        }
    };
}

And here’s my ChannelSettings class with the defaults…

public static class ChannelSettings
{
    public static int MaxBufferPoolSize { get; set; } = 2147483647;
    public static int MaxBufferSize { get; set; } = 2147483647;
    public static int MaxReceivedMessageSize { get; set; } = 2147483647;
    public static int MaxStringContentLength { get; set; } = 2147483647;
 
    public static RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } = ValidateAllCerts;
 
    public static bool ValidateAllCerts(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) => true;
 
    public static class Timeouts
    {
        public static TimeSpan AllTimeouts
        {
            set
            {
                OpenTimeout = value;
                CloseTimeout = value;
                ReceiveTimeout = value;
                SendTimeout = value;
            }
        }
 
        public static TimeSpan OpenTimeout { get; set; } = TimeSpan.FromMinutes(10);
        public static TimeSpan CloseTimeout { get; set; } = TimeSpan.FromMinutes(10);
        public static TimeSpan ReceiveTimeout { get; set; } = TimeSpan.FromMinutes(10);
        public static TimeSpan SendTimeout { get; set; } = TimeSpan.FromMinutes(10);
    }
}