Esempio n. 1
0
        /// <summary>
        /// Called once on applicationstart to initialize WCFService-Client
        /// </summary>
        /// <param name="strEndpointAddress">The endpointAdress to connect to</param>
        public WcfClient(String strEndpointAddress)
        {
            EndpointAddress endpointAddress = new EndpointAddress(strEndpointAddress);

            if (_channel != null)
            {
                return;
            }

            WSHttpBinding wsHttpBinding = new WSHttpBinding
            {
                OpenTimeout            = new TimeSpan(0, 1, 0),
                ReceiveTimeout         = new TimeSpan(0, 1, 0),
                SendTimeout            = new TimeSpan(0, 1, 0),
                BypassProxyOnLocal     = false,
                TransactionFlow        = false,
                HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
                MaxBufferPoolSize      = 2147483647,
                MaxReceivedMessageSize = 2147483647,
                MessageEncoding        = WSMessageEncoding.Text,
                TextEncoding           = Encoding.UTF8,
                UseDefaultWebProxy     = true,
                AllowCookies           = false,
                ReaderQuotas           = new XmlDictionaryReaderQuotas
                {
                    MaxArrayLength         = 2147483647,
                    MaxBytesPerRead        = 2147483647,
                    MaxDepth               = 2147483647,
                    MaxNameTableCharCount  = 2147483647,
                    MaxStringContentLength = 2147483647
                },
                ReliableSession = new OptionalReliableSession
                {
                    Ordered           = true,
                    InactivityTimeout = new TimeSpan(0, 1, 0),
                    Enabled           = true
                },
                Security = new WSHttpSecurity
                {
                    Mode = SecurityMode.None
                }
            };


            _httpFactory = new ChannelFactory <IBuildTaskService>(wsHttpBinding, endpointAddress);
            _channel     = _httpFactory.CreateChannel();
        }
Esempio n. 2
0
        /// <summary>
        /// Called once on applicationstart to initialize WCFService-Client
        /// </summary>
        /// <param name="strEndpointAddress">The endpointAdress to connect to</param>
        public WcfClient(String strEndpointAddress)
        {
            EndpointAddress endpointAddress = new EndpointAddress(strEndpointAddress);
            if (_channel != null)
                return;

            WSHttpBinding wsHttpBinding = new WSHttpBinding
            {
                OpenTimeout = new TimeSpan(0, 1, 0),
                ReceiveTimeout = new TimeSpan(0, 1, 0),
                SendTimeout = new TimeSpan(0, 1, 0),
                BypassProxyOnLocal = false,
                TransactionFlow = false,
                HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
                MaxBufferPoolSize = 2147483647,
                MaxReceivedMessageSize = 2147483647,
                MessageEncoding = WSMessageEncoding.Text,
                TextEncoding = Encoding.UTF8,
                UseDefaultWebProxy = true,
                AllowCookies = false,
                ReaderQuotas = new XmlDictionaryReaderQuotas
                {
                    MaxArrayLength = 2147483647,
                    MaxBytesPerRead = 2147483647,
                    MaxDepth = 2147483647,
                    MaxNameTableCharCount = 2147483647,
                    MaxStringContentLength = 2147483647
                },
                ReliableSession = new OptionalReliableSession
                {
                    Ordered = true,
                    InactivityTimeout = new TimeSpan(0, 1, 0),
                    Enabled = true
                },
                Security = new WSHttpSecurity
                {
                    Mode = SecurityMode.None
                }
            };

            _httpFactory = new ChannelFactory<IBuildTaskService>(wsHttpBinding, endpointAddress);
            _channel = _httpFactory.CreateChannel();
        }