コード例 #1
0
        public ServiceAgent(string Url)
        {
            try
            {
                 InstanceContext context = new InstanceContext(this);
                 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
                 binding.MaxReceivedMessageSize = 2147483647;
                 binding.ReaderQuotas.MaxDepth= 2147483647;
                 binding.ReaderQuotas.MaxStringContentLength=2147483647;
                 binding.ReaderQuotas.MaxArrayLength= 2147483647;
                 binding.ReaderQuotas.MaxBytesPerRead= 2147483647;
                 binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
                 binding.OpenTimeout = TimeSpan.FromMinutes(10);
                 binding.SendTimeout = TimeSpan.FromMinutes(20);
                 binding.ReceiveTimeout = TimeSpan.FromMinutes(20);
                 binding.MaxBufferPoolSize = 2147483647;

                _proxy = new KryptonServiceProxy(context, binding, Url);
                _proxy.Open();
            }
               catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                _proxy = null;
            }
        }
コード例 #2
0
        private void InitializeProxy(string IpAddress, CallBackFunctionSignature callback)
        {
            try
            {
                 Url = string.Format("net.tcp://{0}:8001/KryptonService", IpAddress);
                 _callback = callback;

                 InstanceContext context = new InstanceContext(this);
                 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
                 binding.MaxReceivedMessageSize = 2147483647;
                 binding.ReaderQuotas.MaxDepth= 2147483647;
                 binding.ReaderQuotas.MaxStringContentLength=2147483647;
                 binding.ReaderQuotas.MaxArrayLength= 2147483647;
                 binding.ReaderQuotas.MaxBytesPerRead= 2147483647;
                 binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
                 binding.OpenTimeout = TimeSpan.FromMinutes(10);
                 binding.SendTimeout = TimeSpan.FromMinutes(20);
                 binding.ReceiveTimeout = TimeSpan.FromMinutes(20);
                 binding.MaxBufferPoolSize = 2147483647;

                _proxy = new KryptonServiceProxy(context, binding, Url);
                _proxy.Open();
            }
               catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                _proxy = null;
            }
        }