Ejemplo n.º 1
0
        /// <summary>
        /// Initialize Azure Blast client
        /// </summary>
        private void InitializeBlastClient()
        {
            if (_configuration == null)
            {
                throw new Exception(Resources.AZURE_BLAST_NULL_CONFIGURATION);
            }
            else
            {
                if (_configuration.Connection == null)
                {
                    throw new Exception(Resources.AZURE_BLAST_INVALID_URI);
                }
            }

            BasicHttpBinding httpBinding = new BasicHttpBinding();

            httpBinding.Name                   = "BasicHttpBinding_IBlastService";
            httpBinding.CloseTimeout           = new TimeSpan(0, Configuration.DefaultTimeout, 0);
            httpBinding.OpenTimeout            = new TimeSpan(0, Configuration.DefaultTimeout, 0);
            httpBinding.ReceiveTimeout         = new TimeSpan(0, Configuration.DefaultTimeout, 0);
            httpBinding.SendTimeout            = new TimeSpan(0, Configuration.DefaultTimeout, 0);
            httpBinding.AllowCookies           = false;
            httpBinding.BypassProxyOnLocal     = false;
            httpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
            httpBinding.MaxBufferSize          = 65536;
            httpBinding.MaxBufferPoolSize      = 524288;
            httpBinding.MaxReceivedMessageSize = 65536;
            httpBinding.MessageEncoding        = WSMessageEncoding.Text;
            httpBinding.TextEncoding           = System.Text.Encoding.UTF8;
            httpBinding.TransferMode           = TransferMode.Buffered;
            httpBinding.UseDefaultWebProxy     = true;

            httpBinding.ReaderQuotas.MaxDepth = 32;
            httpBinding.ReaderQuotas.MaxStringContentLength = 8192;
            httpBinding.ReaderQuotas.MaxArrayLength         = 16384;
            httpBinding.ReaderQuotas.MaxBytesPerRead        = 4096;
            httpBinding.ReaderQuotas.MaxNameTableCharCount  = 16384;

            httpBinding.Security.Mode = BasicHttpSecurityMode.None;
            httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            httpBinding.Security.Transport.ProxyCredentialType  = HttpProxyCredentialType.None;
            httpBinding.Security.Transport.Realm = string.Empty;

            httpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            EndpointAddress address = new EndpointAddress(_configuration.Connection);

            _blastClient = new BlastServiceClient(httpBinding, address);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Dispose the managed resource
        /// </summary>
        /// <param name="disposing">If disposing equals true, dispose all resources</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (null != _workerThread)
                {
                    _workerThread.Dispose();
                    _workerThread = null;
                }

                if (null != _blastClient)
                {
                    _blastClient = null;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Dispose the managed resource
        /// </summary>
        /// <param name="disposing">If disposing equals true, dispose all resources</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (null != workerThread)
                {
                    workerThread.Dispose();
                    workerThread = null;
                }

                if (null != blastClient)
                {
                    if (blastClient.State != CommunicationState.Closed)
                    {
                        blastClient.Close();
                    }

                    blastClient = null;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize Azure Blast client
        /// </summary>
        private void InitializeBlastClient()
        {
            BasicHttpBinding httpBinding = new BasicHttpBinding();

            httpBinding.Name                   = "BasicHttpBinding_IBlastService";
            httpBinding.CloseTimeout           = new TimeSpan(0, Configuration.DefaultTimeOut, 0);
            httpBinding.OpenTimeout            = new TimeSpan(0, Configuration.DefaultTimeOut, 0);
            httpBinding.ReceiveTimeout         = new TimeSpan(0, Configuration.DefaultTimeOut, 0);
            httpBinding.SendTimeout            = new TimeSpan(0, Configuration.DefaultTimeOut, 0);
            httpBinding.AllowCookies           = false;
            httpBinding.BypassProxyOnLocal     = false;
            httpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
            httpBinding.MaxBufferSize          = 65536;
            httpBinding.MaxBufferPoolSize      = 524288;
            httpBinding.MaxReceivedMessageSize = 65536;
            httpBinding.MessageEncoding        = WSMessageEncoding.Text;
            httpBinding.TextEncoding           = Encoding.UTF8;
            httpBinding.TransferMode           = TransferMode.Buffered;
            httpBinding.UseDefaultWebProxy     = true;

            httpBinding.ReaderQuotas.MaxDepth = 32;
            httpBinding.ReaderQuotas.MaxStringContentLength = 8192;
            httpBinding.ReaderQuotas.MaxArrayLength         = 16384;
            httpBinding.ReaderQuotas.MaxBytesPerRead        = 4096;
            httpBinding.ReaderQuotas.MaxNameTableCharCount  = 16384;

            httpBinding.Security.Mode = BasicHttpSecurityMode.None;
            httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            httpBinding.Security.Transport.ProxyCredentialType  = HttpProxyCredentialType.None;
            httpBinding.Security.Transport.Realm = string.Empty;

            httpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            EndpointAddress address = new EndpointAddress(
                new Uri("http://blast2.cloudapp.net/BlastService.svc"));

            _blastClient = new BlastServiceClient(httpBinding, address);
        }