コード例 #1
0
ファイル: NetTcpBinding.cs プロジェクト: sveinfid-prospa/wcf
        public override BindingElementCollection CreateBindingElements()
        {
            CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            // order of BindingElements is important
            // add session
            if (reliableSession.Enabled)
            {
                bindingElements.Add(session);
            }
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding
            bindingElements.Add(_encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();

            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }
            _transport.ExtendedProtectionPolicy = _security.Transport.ExtendedProtectionPolicy;
            // add transport (tcp)
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #2
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // context

            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }

            // add encoding (text or mtom)
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(_textEncoding, _mtomEncoding);
            if (MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElements.Add(_textEncoding);
            }
            else if (MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElements.Add(_mtomEncoding);
            }

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #3
0
ファイル: NetHttpsBinding.cs プロジェクト: liujf5566/wcf
        public override BindingElementCollection CreateBindingElements()
        {
            CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            // add security (*optional)
            SecurityBindingElement messageSecurity = BasicHttpSecurity.CreateMessageSecurity();

            if (messageSecurity != null)
            {
                bindingElements.Add(messageSecurity);
            }

            // add encoding
            switch (MessageEncoding)
            {
            case NetHttpMessageEncoding.Text:
                bindingElements.Add(TextMessageEncodingBindingElement);
                break;

            case NetHttpMessageEncoding.Mtom:
                throw ExceptionHelper.PlatformNotSupported(SR.Format(SR.UnsupportedBindingProperty, "MessageEncoding", MessageEncoding));

            default:
                bindingElements.Add(_binaryMessageEncodingBindingElement);
                break;
            }

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #4
0
ファイル: WSTrust13Bindings.cs プロジェクト: rfranr/snippets
        /// <summary>
        /// Creates a kerberos binding with the specified security mode.
        /// On ADFS 2.0 only TransportWithMessageCredential is available.
        /// </summary>
        private static Binding CreateKerberosBinding(SecurityMode securityMode)
        {
            if (securityMode == SecurityMode.None)
            {
                throw new ArgumentException("securityMode None is not allowed");
            }

            BindingElementCollection bindingElements = new BindingElementCollection();

            // Add securtiy binding element
            if (securityMode == SecurityMode.Message)
            {
                bindingElements.Add(
                    SecurityBindingElement.CreateKerberosBindingElement());
            }
            else if (securityMode == SecurityMode.TransportWithMessageCredential)
            {
                bindingElements.Add(
                    SecurityBindingElement.CreateKerberosOverTransportBindingElement());
            }

            // Add encoding binding element
            bindingElements.Add(CreateEncodingBindingElement());

            // Add transport binding element
            HttpTransportBindingElement transportBindingElement =
                CreateTransportBindingElement(securityMode);

            transportBindingElement.AuthenticationScheme = AuthenticationSchemes.Negotiate;
            bindingElements.Add(transportBindingElement);

            // Create binding
            return(new CustomBinding(bindingElements));
        }
コード例 #5
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElementCollection = new BindingElementCollection();

            if (this.reliableSession.Enabled)
            {
                bindingElementCollection.Add(this.session);
            }
            SecurityBindingElement securityBindingElement = this.CreateMessageSecurity();

            if (securityBindingElement != null)
            {
                bindingElementCollection.Add(securityBindingElement);
            }
            Microsoft.ServiceBus.WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElementCollection.Add(this.textEncoding);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElementCollection.Add(this.mtomEncoding);
            }
            bindingElementCollection.Add(this.GetTransport());
            return(bindingElementCollection.Clone());
        }
コード例 #6
0
        //<snippet2>
        // This method creates a CustomBinding using a SymmetricSecurityBindingElement.
        // It is largely equivalent to doing the following:

        // WSHttpBinding b = new WSHttpBinding ( SecurityMode.Message );
        // b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
        // b.Security.Message.NegotiateServiceCredential = false;
        // b.Security.Message.EstablishSecureSession = false;

        // It differs in that it uses MessageProtectionOrder.SignBeforeEncrypt rather
        // than MessageProtectionOrder.SignBeforeEncryptAndEncryptSignature.
        //<snippet3>
        public static Binding CreateCustomBinding()
        {
            // Create an empty BindingElementCollection to populate,
            // then create a custom binding from it.
            BindingElementCollection outputBec = new BindingElementCollection();

            // <snippet6>
            // <snippet5>
            // <snippet4>
            // Create a SymmetricSecurityBindingElement.
            SymmetricSecurityBindingElement ssbe =
                new SymmetricSecurityBindingElement();

            // </snippet4>

            // Set the algorithm suite to one that uses 128-bit keys.
            ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

            // Set MessageProtectionOrder to SignBeforeEncrypt.
            ssbe.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt;
            // </snippet5>

            // Use a Kerberos token as the protection token.
            ssbe.ProtectionTokenParameters = new KerberosSecurityTokenParameters();
            // </snippet6>

            // Add the SymmetricSecurityBindingElement to the BindingElementCollection.
            outputBec.Add(ssbe);
            outputBec.Add(new TextMessageEncodingBindingElement());
            outputBec.Add(new HttpTransportBindingElement());

            // Create a CustomBinding and return it; otherwise, return null.
            return(new CustomBinding(outputBec));
        }
コード例 #7
0
        static void Main(string[] args)
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(new TransactionFlowBindingElement(TransactionProtocol.WSAtomicTransactionOctober2004));
            elements.Add(new ReliableSessionBindingElement(true));
            elements.Add(new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressing10, Encoding.UTF8));
            elements.Add(new HttpTransportBindingElement());

            CustomBinding binding = new CustomBinding(elements);

            ChannelFactory <IHelloIndigoService> factory = new ChannelFactory <IHelloIndigoService>(binding, "http://localhost:8000/HelloIndigoService");
            IHelloIndigoService proxy = null;

            try
            {
                proxy = factory.CreateChannel();
                {
                    string s = proxy.HelloIndigo("hello");
                    Console.WriteLine(s);
                    Console.ReadLine();
                }
            }
            finally
            {
                ICommunicationObject obj = proxy as ICommunicationObject;
                if (obj != null)
                {
                    obj.Close();
                }
            }
        }
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.txFlow
     };
     if (this.reliableSession.Enabled)
     {
         elements.Add(this.session);
     }
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
     if (this.MessageEncoding == WSMessageEncoding.Text)
     {
         elements.Add(this.textEncoding);
     }
     else if (this.MessageEncoding == WSMessageEncoding.Mtom)
     {
         elements.Add(this.mtomEncoding);
     }
     elements.Add(this.GetTransport());
     return elements.Clone();
 }
コード例 #9
0
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security (*optional)
            SecurityBindingElement wsSecurity = this.BasicHttpSecurity.CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding (text or mtom)
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.TextMessageEncodingBindingElement, this.MtomMessageEncodingBindingElement);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElements.Add(this.TextMessageEncodingBindingElement);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElements.Add(this.MtomMessageEncodingBindingElement);
            }
            // add transport (http or https)
            bindingElements.Add(this.GetTransport());

            return(bindingElements.Clone());
        }
コード例 #10
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Add(encoding);
     elements.Add(transport);
     return elements;
 }
コード例 #11
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection        bindingElements = new BindingElementCollection();
            TransportSecurityBindingElement security        = SecurityBindingElement.CreateUserNameOverTransportBindingElement();

            security.IncludeTimestamp = false;
            bindingElements.Add(security);
            TextMessageEncodingBindingElement messageEncoding = new TextMessageEncodingBindingElement();

            messageEncoding.MessageVersion = MessageVersion.Soap11;
            bindingElements.Add(messageEncoding);
            HttpsTransportBindingElement transport = new HttpsTransportBindingElement();

            transport.MaxReceivedMessageSize             = int.MaxValue;
            transport.ManualAddressing                   = false;
            transport.AllowCookies                       = false;
            transport.AuthenticationScheme               = AuthenticationSchemes.Anonymous;
            transport.BypassProxyOnLocal                 = false;
            transport.DecompressionEnabled               = true;
            transport.HostNameComparisonMode             = HostNameComparisonMode.StrongWildcard;
            transport.KeepAliveEnabled                   = true;
            transport.ProxyAuthenticationScheme          = AuthenticationSchemes.Anonymous;
            transport.TransferMode                       = TransferMode.Buffered;
            transport.UnsafeConnectionNtlmAuthentication = false;
            transport.UseDefaultWebProxy                 = true;
            bindingElements.Add(transport);
            return(bindingElements.Clone());
        }
コード例 #12
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection bindingElementsCollection = new BindingElementCollection();
     bindingElementsCollection.Add(this.messageEncodingBindingElement);
     bindingElementsCollection.Add(this.transportBindingElement);
     return bindingElementsCollection.Clone();
 }
コード例 #13
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(binaryEncoding);

            if (this.securityMode == NetHttpSecurityMode.Transport)
            {
                bindingElements.Add(this.httpsTransport);
            }
            else
            {
                if (this.securityMode == NetHttpSecurityMode.TransportCredentialOnly)
                {
                    this.httpTransport.AuthenticationScheme = AuthenticationSchemes.Negotiate;
                }
                else
                {
                    this.httpTransport.AuthenticationScheme = AuthenticationSchemes.Anonymous;
                }
                bindingElements.Add(this.httpTransport);
            }

            return(bindingElements.Clone());
        }
コード例 #14
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection {
                this.context
            };

            if (this.reliableSession.Enabled)
            {
                elements.Add(this.session);
            }
            SecurityBindingElement item = this.CreateMessageSecurity();

            if (item != null)
            {
                elements.Add(item);
            }
            elements.Add(this.encoding);
            BindingElement element2 = this.CreateTransportSecurity();

            if (element2 != null)
            {
                elements.Add(element2);
            }
            this.transport.ExtendedProtectionPolicy = this.security.Transport.ExtendedProtectionPolicy;
            elements.Add(this.transport);
            return(elements.Clone());
        }
コード例 #15
0
        public override BindingElementCollection CreateBindingElements()
        {
            var bindingElements = new BindingElementCollection();

            // if passing credentials via message security, add a security element
            TransportSecurityBindingElement transportSecurityElement = null;

            if (this.SecurityMode == AssertEncryptionHttpSecurityMode.UserNameOverMessage)
            {
                transportSecurityElement = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
            }

            if (this.SecurityMode == AssertEncryptionHttpSecurityMode.UserNameOverTransport)
            {
                transportSecurityElement = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
            }

            if (transportSecurityElement != null)
            {
                bindingElements.Add(transportSecurityElement);
            }

            // add a message encoder element
            //if (this.MessageEncoding == WSMessageEncoding.Text)
            //    bindingElements.Add(this.TextEncoding);
            //else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            //    bindingElements.Add(this.MtomEncoding);

            // add a transport element
            bindingElements.Add(this.GetTransport());

            return(bindingElements);
        }
コード例 #16
0
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding
            bindingElements.Add(_encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();

            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }

            // add transport (tcp)
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #17
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection col = new BindingElementCollection();
     col.Add(be);
     col.Add(tcpbe);
     return col;
 }
コード例 #18
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Add(this.encodingElement);
     elements.Add(this.transportElement);
     return elements.Clone();
 }
コード例 #19
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection {
                this.txFlow
            };

            if (this.reliableSession.Enabled)
            {
                elements.Add(this.session);
            }
            SecurityBindingElement item = this.CreateMessageSecurity();

            if (item != null)
            {
                elements.Add(item);
            }
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                elements.Add(this.textEncoding);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                elements.Add(this.mtomEncoding);
            }
            elements.Add(this.GetTransport());
            return(elements.Clone());
        }
コード例 #20
0
        public static Binding CreateCustomBinding()
        {
            // <Snippet8>
            // <Snippet3>
            SymmetricSecurityBindingElement b =
                SecurityBindingElement.
                CreateAnonymousForCertificateBindingElement();
            // </Snippet3>

            // <Snippet4>
            BindingElementCollection outputBindings =
                new BindingElementCollection();

            // </Snippet4>

            // <Snippet5>
            b.DefaultAlgorithmSuite  = SecurityAlgorithmSuite.Basic128;
            b.MessageProtectionOrder =
                MessageProtectionOrder.SignBeforeEncrypt;
            b.ProtectionTokenParameters =
                new KerberosSecurityTokenParameters();
            // </Snippet5>
            // </Snippet8>

            // <Snippet6>
            outputBindings.Add(b);
            outputBindings.Add(new TextMessageEncodingBindingElement());
            outputBindings.Add(new HttpTransportBindingElement());
            // </Snippet6>

            // <Snippet7>
            return(new CustomBinding(outputBindings));
            // </Snippet7>
        }
コード例 #21
0
        public override BindingElementCollection CreateBindingElements()
        {
            CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection
            {
                // order of BindingElements is important
                // add encoding
                _encoding
            };
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();

            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }
            // TODO: Add ExtendedProtectionPolicy
            _transport.ExtendedProtectionPolicy = _security.Transport.ExtendedProtectionPolicy;
            // add transport (tcp)
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #22
0
        public override BindingElementCollection CreateBindingElements()
        {
            m_transport.HostName       = this.HostName;
            m_transport.Port           = this.Port;
            m_transport.BrokerProtocol = this.BrokerProtocol;
            if (MaxMessageSize != DefaultMaxMessageSize)
            {
                m_transport.MaxReceivedMessageSize = MaxMessageSize;
            }
            BindingElementCollection elements = new BindingElementCollection();

            if (m_transactionsEnabled)
            {
                elements.Add(m_transactionFlow);
            }
            if (!OneWayOnly)
            {
                elements.Add(m_session);
                elements.Add(m_compositeDuplex);
            }
            elements.Add(m_encoding);
            elements.Add(m_transport);

            return(elements);
        }
コード例 #23
0
        private Binding CreateBinaryBinding(bool isSecure)
        {
            var binaryElement = new BinaryMessageEncodingBindingElement();

#if WPF
            binaryElement.ReaderQuotas.MaxStringContentLength = 2147483647;
#endif

            BindingElementCollection elements = new BindingElementCollection();
            elements.Add(binaryElement);

            if (isSecure)
            {
                elements.Add(new HttpsTransportBindingElement()
                {
                    MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647
                });
            }
            else
            {
                elements.Add(new HttpTransportBindingElement()
                {
                    MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647
                });
            }

            return(new CustomBinding(elements));
        }
コード例 #24
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            // order of BindingElements is important
            // context

            // reliable
            if (_reliableSession.Enabled)
            {
                bindingElements.Add(_session);
            }

            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }

            // add encoding
            bindingElements.Add(_textEncoding);

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #25
0
ファイル: source.cs プロジェクト: zhimaqiao51/docs
        static void Main()
        {
            // <snippet1>
            // Create a ServiceHost for the CalculatorService type and provide the base address.
            using (ServiceHost host = new ServiceHost(typeof(BackendService)))
            {
                BindingElementCollection bindingElements = new BindingElementCollection();
                bindingElements.Add(SecurityBindingElement.CreateUserNameOverTransportBindingElement());
                bindingElements.Add(new WindowsStreamSecurityBindingElement());
                bindingElements.Add(new TcpTransportBindingElement());
                CustomBinding backendServiceBinding = new CustomBinding(bindingElements);

                host.AddServiceEndpoint(typeof(ICalculator), backendServiceBinding, "BackendService");

                // Open the ServiceHostBase to create listeners and start listening for messages.
                host.Open();

                // The service can now be accessed.
                Console.WriteLine("The service is ready.");
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();
                host.Close();
            }
            // </snippet1>
        }
コード例 #26
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(this.xmlRpcTextEncoding);
            bindingElements.Add(this.GetTransport());
            return(bindingElements.Clone());
        }
コード例 #27
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(this.byteStreamEncoding);
            bindingElements.Add(this.httpTransport);
            return(bindingElements.Clone());
        }
コード例 #28
0
        public override BindingElementCollection CreateBindingElements()
        {
            var bindingElements = new BindingElementCollection();

            bindingElements.Add(encoding);
            bindingElements.Add(transport);
            return(bindingElements.Clone());
        }
コード例 #29
0
ファイル: MyBinding.cs プロジェクト: Yuanxiangz/WorkSpace
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elemens = new BindingElementCollection();
     elemens.Add(new TextMessageEncodingBindingElement());
     elemens.Add(new MyBindingElement());
     elemens.Add(new HttpTransportBindingElement());
     return elemens.Clone();
 }
コード例 #30
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(encbe);
            elements.Add(ssbbe);
            return(elements);
        }
コード例 #31
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection col = new BindingElementCollection();

            col.Add(be);
            col.Add(tcpbe);
            return(col);
        }
コード例 #32
0
 public override BindingElementCollection CreateBindingElements()
 {
     var res = new BindingElementCollection();
     res.Add(new TextMessageEncodingBindingElement() { MessageVersion = this.messageVersion });
     res.Add(SecurityBindingElement.CreateUserNameOverTransportBindingElement());
     res.Add(new AutoSecuredHttpTransportElement());
     return res;
 }
コード例 #33
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(this.encodingElement);
            elements.Add(this.transportElement);
            return(elements.Clone());
        }
コード例 #34
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(encoding);
            elements.Add(transport);
            return(elements);
        }
コード例 #35
0
ファイル: HttpBinding.cs プロジェクト: reza899/aspnetwebstack
        /// <summary>
        /// Returns an ordered collection of binding elements contained in the current binding.
        /// (Overrides <see cref="System.ServiceModel.Channels.Binding.CreateBindingElements">
        /// Binding.CreateBindingElements</see>.)
        /// </summary>
        /// <returns>
        /// An ordered collection of binding elements contained in the current binding.
        /// </returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(_httpMessageEncodingBindingElement);
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #36
0
        public static Binding CreateKerberosBinding()
        {
            BindingElementCollection bec = new BindingElementCollection();

            bec.Add(SecurityBindingElement.CreateKerberosBindingElement());
            bec.Add(new TextMessageEncodingBindingElement());
            bec.Add(new HttpTransportBindingElement());
            return(new CustomBinding(bec));
        }
コード例 #37
0
        public static Binding CreateUserNameForSslNegotiatedBinding()
        {
            BindingElementCollection bec = new BindingElementCollection();

            bec.Add(SecurityBindingElement.CreateUserNameForSslBindingElement());
            bec.Add(new TextMessageEncodingBindingElement());
            bec.Add(new HttpTransportBindingElement());
            return(new CustomBinding(bec));
        }
コード例 #38
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();
            if (security != null) elements.Add(security);
            elements.Add(messageEncoding);
            elements.Add(transport);

            return elements.Clone();
        }
コード例 #39
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Add(this._trafficControlBindingElement);
     elements.Add(this._messageEncodingBindingElement);
     //elements.Add(this._symmetricSecurityBindingElement);
     //elements.Add(this._transactionFlowBindingElement);
     elements.Add(this._transportBindingElement);
     return elements.Clone();
 }
コード例 #40
0
        public override BindingElementCollection CreateBindingElements()
        {

            BindingElementCollection bindingElements = new BindingElementCollection();
            
            bindingElements.Add(sessionElement);
            bindingElements.Add(encodingElement);
            bindingElements.Add(transportElement);
            
            return bindingElements.Clone();
        }
コード例 #41
0
 public override BindingElementCollection CreateBindingElements()
 {
     var elements = new BindingElementCollection();
     elements.Add(_messageElement);
     if (_sessionElement != null)
     {
         elements.Add(_sessionElement);
     }
     // the transport binding element must be the last one
     elements.Add(_transportElement);
     return elements.Clone();
 }
コード例 #42
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.encoding);
     elements.Add(this.GetTransport());
     return elements.Clone();
 }
コード例 #43
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Clear();
     if ((SecurityMode.Message == this._securityMode) || (SecurityMode.TransportWithMessageCredential == this._securityMode))
     {
         elements.Add(this.ApplyMessageSecurity(this.CreateSecurityBindingElement()));
     }
     elements.Add(this.CreateEncodingBindingElement());
     elements.Add(this.CreateTransportBindingElement());
     return elements.Clone();
 }
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.context,
         this.encoding
     };
     WindowsStreamSecurityBindingElement item = this.CreateTransportSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.namedPipe);
     return elements.Clone();
 }
コード例 #45
0
        /// <summary>
        /// Create the set of binding elements that make up this binding. 
        /// NOTE: order of binding elements is important.
        /// </summary>
        /// <returns></returns>
        public override BindingElementCollection CreateBindingElements()
        {   
            BindingElementCollection bindingElements = new BindingElementCollection();

            if (ReliableSessionEnabled)
            {
                bindingElements.Add(session);
                bindingElements.Add(compositeDuplex);
            }

            bindingElements.Add(encoding);
            bindingElements.Add(transport);

            return bindingElements.Clone();
        }
 protected override void AddBindingElements(BindingElementCollection bindingElements)
 {
     bindingElements.Add(new BinaryMessageEncodingBindingElement());
     base.AddTransactionFlowBindingElement(bindingElements);
     base.AddWindowsStreamSecurityBindingElement(bindingElements);
     base.AddNamedPipeBindingElement(bindingElements);
 }
コード例 #47
0
ファイル: QpidBinding.cs プロジェクト: drzo/opensim4opencog
        public override BindingElementCollection CreateBindingElements()
        {
            var elements = new BindingElementCollection();

            if (_transactionsEnabled)
            {
                elements.Add(_transactionFlow);
            }
            if (!OneWayOnly)
            {
                elements.Add(_session);
                elements.Add(_compositeDuplex);
            }
            elements.Add(_encoding);
            elements.Add(_transport);

            return elements;
        }
 private void AddWindowsHttpsTransportBindingElement(BindingElementCollection bindingElements)
 {
     HttpsTransportBindingElement item = new HttpsTransportBindingElement {
         RequireClientCertificate = false,
         UseDefaultWebProxy = false,
         AuthenticationScheme = AuthenticationSchemes.Negotiate
     };
     bindingElements.Add(item);
 }
 protected override void AddBindingElements(BindingElementCollection bindingElements)
 {
     if (this.supportingTokenBE != null)
     {
         base.AddTransportSecurityBindingElement(bindingElements);
         bindingElements.Add(this.supportingTokenBE);
     }
     base.AddBindingElements(bindingElements);
 }
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.txFlow,
         this.session
     };
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.compositeDuplex);
     elements.Add(this.oneWay);
     WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
     if (this.MessageEncoding == WSMessageEncoding.Text)
     {
         elements.Add(this.textEncoding);
     }
     else if (this.MessageEncoding == WSMessageEncoding.Mtom)
     {
         elements.Add(this.mtomEncoding);
     }
     elements.Add(this.httpTransport);
     return elements.Clone();
 }
コード例 #51
0
        /// <summary>
        /// Support for configurable security parameters in binding. Changed default reader quotas and message size limits
        /// </summary>
        /// <returns></returns>
        public override BindingElementCollection CreateBindingElements()
        {
            var res = new BindingElementCollection();
            XmlDictionaryReaderQuotas rqMax = XmlDictionaryReaderQuotas.Max;
            TextMessageEncodingBindingElement tb = new TextMessageEncodingBindingElement()
            {
                MessageVersion = this.messageVersion
            };
            rqMax.CopyTo(tb.ReaderQuotas);
            res.Add(tb);

            TransportSecurityBindingElement security = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
            security.IncludeTimestamp = this.includeTimeStamp;
            if (this.enableUnsecuredResponse)
            {
                security.EnableUnsecuredResponse = true;
                security.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;
            }
            res.Add(security);
            res.Add(new AutoSecuredHttpTransportElement());
            return res;
        }
コード例 #52
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.context
     };
     if (this.reliableSession.Enabled)
     {
         elements.Add(this.session);
     }
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.encoding);
     BindingElement element2 = this.CreateTransportSecurity();
     if (element2 != null)
     {
         elements.Add(element2);
     }
     this.transport.ExtendedProtectionPolicy = this.security.Transport.ExtendedProtectionPolicy;
     elements.Add(this.transport);
     return elements.Clone();
 }
コード例 #53
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = base.CreateBindingElements();

            BindingElementCollection customElements = new BindingElementCollection();
            foreach (BindingElement element in elements)
            {
                BindingElement customElement = element;
                if (element is MessageEncodingBindingElement)
                {
                    MessageEncodingBindingElement encodingElement = (MessageEncodingBindingElement)element;

                    customElement = new CompressionMessageEncodingBindingElement(encodingElement);
                }

                customElements.Add(customElement);
            }

            return customElements.Clone();
        }
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();
            switch (this.Resolver.Mode)
            {
                case PeerResolverMode.Auto:
                    if (!this.CanUseCustomResolver())
                    {
                        if (!PeerTransportDefaults.ResolverAvailable)
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverRequired")));
                        }
                        elements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                        break;
                    }
                    elements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                    break;

                case PeerResolverMode.Pnrp:
                    if (!PeerTransportDefaults.ResolverAvailable)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverRequired")));
                    }
                    elements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                    break;

                case PeerResolverMode.Custom:
                    if (!this.CanUseCustomResolver())
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverSettingsInvalid")));
                    }
                    elements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                    break;

                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverRequired")));
            }
            elements.Add(this.encoding);
            elements.Add(this.transport);
            this.transport.Security.Mode = this.Security.Mode;
            this.transport.Security.Transport.CredentialType = this.Security.Transport.CredentialType;
            return elements.Clone();
        }
コード例 #55
0
        /// <summary>
        /// Returns an ordered collection of binding elements contained in the current binding. 
        /// (Overrides <see cref="System.ServiceModel.Channels.Binding.CreateBindingElements">
        /// Binding.CreateBindingElements</see>.)
        /// </summary>
        /// <returns>
        /// An ordered collection of binding elements contained in the current binding.
        /// </returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(_httpMessageEncodingBindingElement);
            bindingElements.Add(GetTransport());

            return bindingElements.Clone();
        }
コード例 #56
0
        private Binding CreateBinaryBinding(bool isSecure)
        {
            var binaryElement = new BinaryMessageEncodingBindingElement();
            #if WPF
            binaryElement.ReaderQuotas.MaxStringContentLength = 2147483647;
            #endif

            BindingElementCollection elements = new BindingElementCollection();
            elements.Add(binaryElement);

            if (isSecure)
                elements.Add(new HttpsTransportBindingElement() { MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647 });
            else
                elements.Add(new HttpTransportBindingElement() { MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647 });

            return new CustomBinding(elements);
        }
コード例 #57
0
        public override BindingElementCollection CreateBindingElements()
        {
            m_transport.HostName = this.HostName;
            m_transport.Port = this.Port;
            m_transport.BrokerProtocol = this.BrokerProtocol;
            if (MaxMessageSize != DefaultMaxMessageSize)
            {
                m_transport.MaxReceivedMessageSize = MaxMessageSize;
            }
            BindingElementCollection elements = new BindingElementCollection();

            if (m_transactionsEnabled)
            {
                elements.Add(m_transactionFlow);
            }
            if (!OneWayOnly)
            {
                elements.Add(m_session);
                elements.Add(m_compositeDuplex);
            }
            elements.Add(m_encoding);
            elements.Add(m_transport);

            return elements;
        }
コード例 #58
0
 public override BindingElementCollection CreateBindingElements()
 { 
     BindingElementCollection bindingElements = new BindingElementCollection();
     bindingElements.Add(this.byteStreamEncoding);
     bindingElements.Add(this.httpTransport);
     return bindingElements.Clone();
 }
コード例 #59
0
ファイル: NetTcpBinding.cs プロジェクト: shijiaxing/wcf
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();
            if (wsSecurity != null)
                bindingElements.Add(wsSecurity);
            // add encoding
            bindingElements.Add(_encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();
            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }

            // add transport (tcp)
            bindingElements.Add(_transport);

            return bindingElements.Clone();
        }
コード例 #60
0
 /// <summary>
 /// Creates a clone of the existing BindingElement and returns it
 /// </summary>
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection bindingElements = new BindingElementCollection();
     //Only create once
     bindingElements.Add(this.BindingElement);
     //Return the clone
     return bindingElements.Clone();
 }