コード例 #1
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElement         tx  = new TransactionFlowBindingElement(TransactionProtocol.WSAtomicTransactionOctober2004);
            SecurityBindingElement sec = CreateMessageSecurity();
            var msg = new BinaryMessageEncodingBindingElement();

            if (ReaderQuotas != null)
            {
                ReaderQuotas.CopyTo(msg.ReaderQuotas);
            }
            var                   trsec = CreateTransportSecurity();
            BindingElement        tr    = GetTransport();
            List <BindingElement> list  = new List <BindingElement> ();

            if (tx != null)
            {
                list.Add(tx);
            }
            if (sec != null)
            {
                list.Add(sec);
            }
            list.Add(msg);
            if (trsec != null)
            {
                list.Add(trsec);
            }
            list.Add(tr);
            return(new BindingElementCollection(list.ToArray()));
        }
コード例 #2
0
        public override void CopyFrom(ServiceModelExtensionElement from)
        {
            base.CopyFrom(from);
            var c = (WebMessageEncodingElement)from;

            MaxReadPoolSize  = c.MaxReadPoolSize;
            MaxWritePoolSize = c.MaxWritePoolSize;
            ReaderQuotas.CopyFrom(c.ReaderQuotas);
            WriteEncoding = c.WriteEncoding;
        }
コード例 #3
0
        public override void ApplyConfiguration(BindingElement element)
        {
            var b = (TextMessageEncodingBindingElement)element;

            b.MaxReadPoolSize  = MaxReadPoolSize;
            b.MaxWritePoolSize = MaxWritePoolSize;
            b.MessageVersion   = MessageVersion;
            b.WriteEncoding    = WriteEncoding;

            ReaderQuotas.ApplyConfiguration(b.ReaderQuotas);
        }
コード例 #4
0
        public override void CopyFrom(ServiceModelExtensionElement element)
        {
            var b = (TextMessageEncodingElement)element;

            MaxReadPoolSize  = b.MaxReadPoolSize;
            MaxWritePoolSize = b.MaxWritePoolSize;
            MessageVersion   = b.MessageVersion;
            WriteEncoding    = b.WriteEncoding;

            ReaderQuotas.CopyFrom(b.ReaderQuotas);
        }
コード例 #5
0
ファイル: NetNamedPipeBinding.cs プロジェクト: raj581/Marvin
        public override BindingElementCollection CreateBindingElements()
        {
            var mbe = new BinaryMessageEncodingBindingElement();

            if (ReaderQuotas != null)
            {
                ReaderQuotas.CopyTo(mbe.ReaderQuotas);
            }

            return(new BindingElementCollection(new BindingElement [] { mbe, transport.Clone() }));
        }
コード例 #6
0
        protected internal override void InitializeFrom(BindingElement element)
        {
            var b = (TextMessageEncodingBindingElement)element;

            MaxReadPoolSize  = b.MaxReadPoolSize;
            MaxWritePoolSize = b.MaxWritePoolSize;
            MessageVersion   = b.MessageVersion;
            WriteEncoding    = b.WriteEncoding;

            ReaderQuotas.InitializeFrom(b.ReaderQuotas);
        }
コード例 #7
0
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            var b = (WebMessageEncodingBindingElement)bindingElement;

            b.ContentTypeMapper = (WebContentTypeMapper)Activator.CreateInstance(Type.GetType(WebContentTypeMapperType), true);
            b.MaxReadPoolSize   = MaxReadPoolSize;
            b.MaxWritePoolSize  = MaxWritePoolSize;
            b.WriteEncoding     = WriteEncoding;
            ReaderQuotas.ApplyConfiguration(b.ReaderQuotas);
        }
コード例 #8
0
        CreateBindingElements()
        {
            var mbe = new BinaryMessageEncodingBindingElement();

            if (ReaderQuotas != null)
            {
                ReaderQuotas.CopyTo(mbe.ReaderQuotas);
            }

            var prbe = Resolver.CreateBinding();

            return(new BindingElementCollection(new BindingElement [] { mbe, prbe, transport.Clone() }));
        }
コード例 #9
0
 MessageEncodingBindingElement BuildMessageEncodingBindingElement()
 {
     if (MessageEncoding == WSMessageEncoding.Text)
     {
         TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement(
             MessageVersion.CreateVersion(EnvelopeVersion, AddressingVersion.None), TextEncoding);
         ReaderQuotas.CopyTo(tm.ReaderQuotas);
         return(tm);
     }
     else
     {
         return(new MtomMessageEncodingBindingElement(
                    MessageVersion.CreateVersion(EnvelopeVersion, AddressingVersion.None), TextEncoding));
     }
 }
コード例 #10
0
        protected override void OnApplyConfiguration(Binding binding)
        {
            var b = (WSHttpBindingBase)binding;

            b.BypassProxyOnLocal     = BypassProxyOnLocal;
            b.HostNameComparisonMode = HostNameComparisonMode;
            b.MaxBufferPoolSize      = MaxBufferPoolSize;
            b.MaxReceivedMessageSize = MaxReceivedMessageSize;
            b.MessageEncoding        = MessageEncoding;
            b.ProxyAddress           = ProxyAddress;
            b.ReaderQuotas           = ReaderQuotas.Create();
            ReliableSession.ApplyConfiguration(b.ReliableSession);
            b.TextEncoding       = TextEncoding;
            b.TransactionFlow    = TransactionFlow;
            b.UseDefaultWebProxy = UseDefaultWebProxy;
        }
コード例 #11
0
        MessageEncodingBindingElement BuildMessageEncodingBindingElement()
        {
            if (MessageEncoding == WSMessageEncoding.Text)
            {
                TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement(MessageVersion.CreateVersion(EnvelopeVersion, AddressingVersion.None), TextEncoding);
                ReaderQuotas.CopyTo(tm.ReaderQuotas);
                return(tm);
            }
            else
            {
                                #if NET_2_1 || XAMMAC_4_5
                throw new NotImplementedException();
#else
                return(new MtomMessageEncodingBindingElement(MessageVersion.CreateVersion(EnvelopeVersion, AddressingVersion.None), TextEncoding));
                                #endif
            }
        }
コード例 #12
0
        public override Binding CreateBinding()
        {
            var binding = new WSHttpBinding(Security.Mode)
            {
                CloseTimeout           = CloseTimeout,
                MaxBufferPoolSize      = MaxBufferPoolSize,
                MaxReceivedMessageSize = MaxReceivedMessageSize,
                Name           = Name,
                OpenTimeout    = OpenTimeout,
                ReaderQuotas   = ReaderQuotas.Clone(),
                ReceiveTimeout = ReceiveTimeout,
                SendTimeout    = SendTimeout,
            };

            //binding.AllowCookies = this.AllowCookies;
            Security.ApplyConfiguration(binding.Security);
            return(binding);
        }
コード例 #13
0
        protected override void OnApplyConfiguration(Binding binding)
        {
            HttpBindingBase basicHttpBinding = (HttpBindingBase)binding;

            basicHttpBinding.AllowCookies           = AllowCookies;
            basicHttpBinding.BypassProxyOnLocal     = BypassProxyOnLocal;
            basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode;
            basicHttpBinding.MaxBufferPoolSize      = MaxBufferPoolSize;
            basicHttpBinding.MaxBufferSize          = MaxBufferSize;
            basicHttpBinding.MaxReceivedMessageSize = MaxReceivedMessageSize;
            basicHttpBinding.ProxyAddress           = ProxyAddress;

            ReaderQuotas.ApplyConfiguration(basicHttpBinding.ReaderQuotas);

            basicHttpBinding.TextEncoding       = TextEncoding;
            basicHttpBinding.TransferMode       = TransferMode;
            basicHttpBinding.UseDefaultWebProxy = UseDefaultWebProxy;
        }
コード例 #14
0
ファイル: ZMQBinding.cs プロジェクト: ybqwerty/MessageBus
        public override BindingElementCollection CreateBindingElements()
        {
            BinaryMessageEncodingBindingElement encoding = new BinaryMessageEncodingBindingElement();

            ZMQTransportBindingElement transport = new ZMQTransportBindingElement(Scheme, SocketMode);

            if (ReaderQuotas != null)
            {
                ReaderQuotas.CopyTo(encoding.ReaderQuotas);
            }

            BindingElementCollection collection = new BindingElementCollection
            {
                encoding,
                transport
            };

            return(collection);
        }
コード例 #15
0
        public override Binding CreateBinding()
        {
            var binding = new BasicHttpBinding(Security.Mode)
            {
                Name = Name,
                MaxReceivedMessageSize = MaxReceivedMessageSize,
                MaxBufferSize          = MaxBufferSize,
                ReceiveTimeout         = ReceiveTimeout,
                CloseTimeout           = CloseTimeout,
                OpenTimeout            = OpenTimeout,
                SendTimeout            = SendTimeout,
                TransferMode           = TransferMode,
                TextEncoding           = TextEncoding,
                ReaderQuotas           = ReaderQuotas.Clone(),
            };

            Security.ApplyConfiguration(binding.Security);
            return(binding);
        }
コード例 #16
0
        MessageEncodingBindingElement BuildMessageEncodingBindingElement()
        {
            if (MessageEncoding == WSMessageEncoding.Text)
            {
                TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement(
                    MessageVersion.CreateVersion(EnvelopeVersion, AddressingVersion.None), TextEncoding);
#if !NET_2_1
                ReaderQuotas.CopyTo(tm.ReaderQuotas);
#endif
                return(tm);
            }
            else
#if NET_2_1
            { throw new SystemException("INTERNAL ERROR: should not happen"); }
#else
            { return(new MtomMessageEncodingBindingElement(
                         MessageVersion.CreateVersion(EnvelopeVersion, AddressingVersion.None), TextEncoding)); }
#endif
        }
コード例 #17
0
        protected internal override void InitializeFrom(Binding binding)
        {
            HttpBindingBase b = (HttpBindingBase)binding;

            base.InitializeFrom(binding);
            AllowCookies           = b.AllowCookies;
            BypassProxyOnLocal     = b.BypassProxyOnLocal;
            HostNameComparisonMode = b.HostNameComparisonMode;
            MaxBufferPoolSize      = b.MaxBufferPoolSize;
            MaxBufferSize          = b.MaxBufferSize;
            MaxReceivedMessageSize = b.MaxReceivedMessageSize;
            ProxyAddress           = b.ProxyAddress;

            ReaderQuotas.ApplyConfiguration(b.ReaderQuotas);

            TextEncoding       = b.TextEncoding;
            TransferMode       = b.TransferMode;
            UseDefaultWebProxy = b.UseDefaultWebProxy;
        }
コード例 #18
0
        protected override void OnApplyConfiguration(Binding binding)
        {
            NetTcpBinding n = (NetTcpBinding)binding;

            n.CloseTimeout           = CloseTimeout;
            n.HostNameComparisonMode = HostNameComparisonMode;
            n.ListenBacklog          = ListenBacklog;
            n.MaxBufferPoolSize      = MaxBufferPoolSize;
            n.MaxBufferSize          = MaxBufferSize;
            n.MaxConnections         = MaxConnections;
            n.MaxReceivedMessageSize = MaxReceivedMessageSize;
            n.OpenTimeout            = OpenTimeout;
            n.PortSharingEnabled     = PortSharingEnabled;
            if (ReaderQuotas != null)
            {
                n.ReaderQuotas = ReaderQuotas.Create();
            }
            n.ReceiveTimeout = ReceiveTimeout;

            // FIXME: apply this too.
            //ReliableSession.ApplyTo (n.ReliableSession);

            if (Security != null)
            {
                n.Security.Mode = Security.Mode;
                if (Security.Message != null)
                {
                    n.Security.Message.AlgorithmSuite       = Security.Message.AlgorithmSuite;
                    n.Security.Message.ClientCredentialType = Security.Message.ClientCredentialType;
                }
                if (Security.Transport != null)
                {
                    n.Security.Transport.ClientCredentialType = Security.Transport.ClientCredentialType;
                    n.Security.Transport.ProtectionLevel      = Security.Transport.ProtectionLevel;
                }
            }

            n.SendTimeout         = SendTimeout;
            n.TransactionFlow     = TransactionFlow;
            n.TransactionProtocol = TransactionProtocol;
            n.TransferMode        = TransferMode;
        }
コード例 #19
0
        public override BindingElementCollection CreateBindingElements()
        {
            _transport.BrokerProtocol           = BrokerProtocol;
            _transport.TransactedReceiveEnabled = ExactlyOnce;
            _transport.TTL                = TTL;
            _transport.AutoDelete         = AutoDelete;
            _transport.PersistentDelivery = PersistentDelivery;
            _transport.AutoBindExchange   = AutoBindExchange;
            _transport.ReplyToQueue       = ReplyToQueue;
            _transport.ReplyToExchange    = ReplyToExchange;
            _transport.OneWayOnly         = OneWayOnly;
            _transport.ApplicationId      = ApplicationId;
            _transport.MessageFormat      = MessageFormat;
            _transport.HeaderNamespace    = HeaderNamespace;
            _transport.Immediate          = Immediate;
            _transport.Mandatory          = Mandatory;

            if (ReaderQuotas != null)
            {
                ReaderQuotas.CopyTo(_textEncoding.ReaderQuotas);
                ReaderQuotas.CopyTo(_mtomEncoding.ReaderQuotas);
                ReaderQuotas.CopyTo(_binaryEncoding.ReaderQuotas);
            }

            BindingElementCollection elements = new BindingElementCollection();

            if (!OneWayOnly)
            {
                elements.Add(_duplex);
            }

            elements.Add(_binaryEncoding);
            elements.Add(_mtomEncoding);
            elements.Add(_textEncoding);
            elements.Add(_transport);

            return(elements);
        }
コード例 #20
0
        public override Binding CreateBinding()
        {
            var binding = new NetHttpBinding(Security.Mode)
            {
                Name = Name,
                MaxReceivedMessageSize = MaxReceivedMessageSize,
                MaxBufferSize          = MaxBufferSize,
                ReceiveTimeout         = ReceiveTimeout,
                CloseTimeout           = CloseTimeout,
                OpenTimeout            = OpenTimeout,
                SendTimeout            = SendTimeout,
                TransferMode           = TransferMode,
                TextEncoding           = TextEncoding,
                MessageEncoding        = MessageEncoding,
                ReaderQuotas           = ReaderQuotas.Clone(),
            };

            binding.MessageEncoding = MessageEncoding;
            //WebSocketSettings.ApplyConfiguration(netHttpBinding.WebSocketSettings);
            // this.ReliableSession.ApplyConfiguration(netHttpBinding.ReliableSession);
            Security.ApplyConfiguration(binding.Security);
            return(binding);
        }
コード例 #21
0
        protected override void OnApplyConfiguration(Binding binding)
        {
            var n = (NetPeerTcpBinding)binding;

            n.ListenIPAddress        = ListenIPAddress;
            n.MaxBufferPoolSize      = MaxBufferPoolSize;
            n.MaxReceivedMessageSize = MaxReceivedMessageSize;
            n.Port         = Port;
            n.ReaderQuotas = ReaderQuotas.Create();
            if (Resolver != null)
            {
                if (Resolver.Custom != null)
                {
                    n.Resolver.Custom.Address = new EndpointAddress(Resolver.Custom.Address, Resolver.Custom.Identity.Create(), Resolver.Custom.Headers.Headers);
                    if (Resolver.Custom.Binding != null)
                    {
                        var bcol = ConfigUtil.BindingsSection [Resolver.Custom.Binding];
                        var bc   = bcol.ConfiguredBindings.First(b => b.Name == Resolver.Custom.BindingConfiguration);
                        n.Resolver.Custom.Binding = (Binding)Activator.CreateInstance(bcol.BindingType, new object[0]);
                        bc.ApplyConfiguration(n.Resolver.Custom.Binding);
                    }
                    // FIXME: correct type instantiation.
                    if (!String.IsNullOrEmpty(Resolver.Custom.ResolverType))
                    {
                        n.Resolver.Custom.Resolver = (PeerResolver)Activator.CreateInstance(Type.GetType(Resolver.Custom.ResolverType), new object [0]);
                    }
                }
                n.Resolver.Mode           = Resolver.Mode;
                n.Resolver.ReferralPolicy = Resolver.ReferralPolicy;
            }
            if (Security != null)
            {
                n.Security.Mode = Security.Mode;
                n.Security.Transport.CredentialType = Security.Transport.CredentialType;
            }
        }