当前位置: 首页>>代码示例>>C#>>正文


C# BinaryMessageEncodingBindingElement类代码示例

本文整理汇总了C#中BinaryMessageEncodingBindingElement的典型用法代码示例。如果您正苦于以下问题:C# BinaryMessageEncodingBindingElement类的具体用法?C# BinaryMessageEncodingBindingElement怎么用?C# BinaryMessageEncodingBindingElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BinaryMessageEncodingBindingElement类属于命名空间,在下文中一共展示了BinaryMessageEncodingBindingElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FileSystemDispatcher_Picks_Up_Existing_Messages

        public void FileSystemDispatcher_Picks_Up_Existing_Messages()
        {
            BinaryMessageEncodingBindingElement element = new BinaryMessageEncodingBindingElement();
            MessageEncoder encoder = element.CreateMessageEncoderFactory().Encoder;

            ServiceBusRuntime dispatchRuntime = new ServiceBusRuntime(new DirectDeliveryCore());
            var subscription = new SubscriptionEndpoint(Guid.NewGuid(), "File System Dispatcher", null, null, typeof(IContract), new FileSystemDispatcher(new ConverterMessageDeliveryWriterFactory(encoder,typeof(IContract)),Config.IncomingFilePath), new PassThroughMessageFilter());
            dispatchRuntime.Subscribe(subscription);

            ServiceBusRuntime listenerRuntime = new ServiceBusRuntime(new DirectDeliveryCore());
            var listener = new ListenerEndpoint(Guid.NewGuid(), "File System Listener", null, null, typeof(IContract), new FileSystemListener(new ConverterMessageDeliveryReaderFactory(encoder, typeof(IContract)),Config.IncomingFilePath, Config.ProcessedFilePath));
            listenerRuntime.AddListener(listener);
            listenerRuntime.Subscribe(new SubscriptionEndpoint(Guid.NewGuid(), "Pass through", null, null, typeof(IContract), new ActionDispatcher((se, md) => { }), new PassThroughMessageFilter()));

            var dispatchTester = new ServiceBusTest(dispatchRuntime);
            var listenerTester = new ServiceBusTest(listenerRuntime);

            string message = "test this thing";

            dispatchTester.StartAndStop(() =>
            {
                dispatchRuntime.PublishOneWay(typeof(IContract), "PublishThis", message);

                listenerTester.WaitForDeliveries(1, TimeSpan.FromSeconds(10), () =>
                {
                });
            });

            dispatchRuntime.RemoveSubscription(subscription);
        }
开发者ID:jezell,项目名称:iserviceoriented,代码行数:30,代码来源:TestFileSystemDispatchersAndListeners.cs

示例2: NetTcpBinding

 private NetTcpBinding(TcpTransportBindingElement transport,
               BinaryMessageEncodingBindingElement encoding,
               NetTcpSecurity security)
     : this()
 {
     _security = security;
 }
开发者ID:shijiaxing,项目名称:wcf,代码行数:7,代码来源:NetTcpBinding.cs

示例3: NetTcpBinding

 NetTcpBinding(TcpTransportBindingElement transport, BinaryMessageEncodingBindingElement encoding, TransactionFlowBindingElement context, ReliableSessionBindingElement session, NetTcpSecurity security)
     : this()
 {
     this.security = security;
     this.ReliableSession.Enabled = session != null;
     InitializeFrom(transport, encoding, context, session);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:NetTcpBinding.cs

示例4: CreateBinding

 private void CreateBinding()
 {
     Collection<BindingElement> bindingElementsInTopDownChannelStackOrder = new Collection<BindingElement>();
     BindingElement securityBindingElement = this.config.SecurityManager.GetSecurityBindingElement();
     if (securityBindingElement != null)
     {
         bindingElementsInTopDownChannelStackOrder.Add(securityBindingElement);
     }
     TcpTransportBindingElement item = new TcpTransportBindingElement {
         MaxReceivedMessageSize = this.config.MaxReceivedMessageSize,
         MaxBufferPoolSize = this.config.MaxBufferPoolSize,
         TeredoEnabled = true
     };
     MessageEncodingBindingElement encodingBindingElement = null;
     if (this.messageHandler != null)
     {
         encodingBindingElement = this.messageHandler.EncodingBindingElement;
     }
     if (encodingBindingElement == null)
     {
         BinaryMessageEncodingBindingElement element4 = new BinaryMessageEncodingBindingElement();
         this.config.ReaderQuotas.CopyTo(element4.ReaderQuotas);
         bindingElementsInTopDownChannelStackOrder.Add(element4);
     }
     else
     {
         bindingElementsInTopDownChannelStackOrder.Add(encodingBindingElement);
     }
     bindingElementsInTopDownChannelStackOrder.Add(item);
     this.binding = new CustomBinding(bindingElementsInTopDownChannelStackOrder);
     this.binding.ReceiveTimeout = TimeSpan.MaxValue;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:PeerService.cs

示例5: BuildCustomBinding

 internal static CustomBinding BuildCustomBinding(bool isSsl)
 {
     BinaryMessageEncodingBindingElement binary = new BinaryMessageEncodingBindingElement();
     HttpTransportBindingElement transport = isSsl ? new HttpsTransportBindingElement() : new HttpTransportBindingElement();
     transport.MaxBufferSize = 2147483647;
     transport.MaxReceivedMessageSize = 2147483647;
     return new CustomBinding(binary, transport);
 }
开发者ID:ssickles,项目名称:archive,代码行数:8,代码来源:IdentityServiceProxy.cs

示例6: InitializeValue

        private void InitializeValue()
        {
            _compressionTypeOptions = CompressionTypeOptions.None;
            _operationBehaviours = new Dictionary<string, OperationBehaviourElement>();

            this._encoding = new BinaryMessageEncodingBindingElement();
            this._transport = GetTransport();
            this._mainTransport = new ProtoBufMetaDataBindingElement(this._transport);
        }
开发者ID:chenzuo,项目名称:ProtoBuf.Services,代码行数:9,代码来源:ProtoBufBinding.cs

示例7: CompressionFormat_Property_Sets

    public static void CompressionFormat_Property_Sets(CompressionFormat format)
    {
        BinaryMessageEncodingBindingElement bindingElement = new BinaryMessageEncodingBindingElement();
        bindingElement.CompressionFormat = format;
        Assert.Equal(format, bindingElement.CompressionFormat);

        // Note: invalid formats can be tested once we have a transport underneath, as it's the transport that determines 
        // whether or not the CompressionFormat is valid for it. 
    }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:9,代码来源:BinaryMessageEncodingBindingElementTest.cs

示例8: UaSoapXmlOverTcpBinding

        /// <summary>
        /// Initializes the binding.
        /// </summary>
        /// <param name="namespaceUris">The namespace uris.</param>
        /// <param name="factory">The factory.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="description">The description.</param>
        public UaSoapXmlOverTcpBinding(
            NamespaceTable        namespaceUris,
            EncodeableFactory     factory,
            EndpointConfiguration configuration,
            EndpointDescription   description)
        :
            base(namespaceUris, factory, configuration)
        {                   
            if (description != null && description.SecurityMode != MessageSecurityMode.None)
            {
                SymmetricSecurityBindingElement bootstrap = (SymmetricSecurityBindingElement)SecurityBindingElement.CreateMutualCertificateBindingElement();
                
                bootstrap.MessageProtectionOrder       = MessageProtectionOrder.SignBeforeEncryptAndEncryptSignature;
                bootstrap.DefaultAlgorithmSuite        = SecurityPolicies.ToSecurityAlgorithmSuite(description.SecurityPolicyUri);
                bootstrap.IncludeTimestamp             = true;
                bootstrap.MessageSecurityVersion       = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
                // bootstrap.MessageSecurityVersion       = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;
                bootstrap.RequireSignatureConfirmation = false;
                bootstrap.SecurityHeaderLayout         = SecurityHeaderLayout.Strict;
                
                m_security = (SymmetricSecurityBindingElement)SecurityBindingElement.CreateSecureConversationBindingElement(bootstrap, true);
                
                m_security.MessageProtectionOrder       = MessageProtectionOrder.EncryptBeforeSign;
                m_security.DefaultAlgorithmSuite        = SecurityPolicies.ToSecurityAlgorithmSuite(description.SecurityPolicyUri);
                m_security.IncludeTimestamp             = true;
                m_security.MessageSecurityVersion       = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
                // m_security.MessageSecurityVersion       = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;
                m_security.RequireSignatureConfirmation = false;
                m_security.SecurityHeaderLayout         = SecurityHeaderLayout.Strict;

                m_security.SetKeyDerivation(true);
            }
            
            m_encoding = new BinaryMessageEncodingBindingElement();
           
            // WCF does not distinguish between arrays and byte string.
            int maxArrayLength = configuration.MaxArrayLength;

            if (configuration.MaxArrayLength < configuration.MaxByteStringLength)
            {
                maxArrayLength = configuration.MaxByteStringLength;
            }

            m_encoding.ReaderQuotas.MaxArrayLength         = maxArrayLength;
            m_encoding.ReaderQuotas.MaxStringContentLength = configuration.MaxStringLength;
            m_encoding.ReaderQuotas.MaxBytesPerRead        = Int32.MaxValue;
            m_encoding.ReaderQuotas.MaxDepth               = Int32.MaxValue;
            m_encoding.ReaderQuotas.MaxNameTableCharCount  = Int32.MaxValue;

            m_transport = new System.ServiceModel.Channels.TcpTransportBindingElement();

            m_transport.ManualAddressing       = false;
            m_transport.MaxBufferPoolSize      = Int32.MaxValue;
            m_transport.MaxReceivedMessageSize = configuration.MaxMessageSize;
        }
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:62,代码来源:UaSoapXmlOverTcpBinding.cs

示例9: Default_Ctor_Initializes_Properties

    public static void Default_Ctor_Initializes_Properties()
    {
        BinaryMessageEncodingBindingElement bindingElement = new BinaryMessageEncodingBindingElement();

        Assert.Equal<CompressionFormat>(CompressionFormat.None, bindingElement.CompressionFormat);
        Assert.Equal<int>(2048, bindingElement.MaxSessionSize);
        Assert.Equal<MessageVersion>(MessageVersion.Default, bindingElement.MessageVersion);

        Assert.True(TestHelpers.XmlDictionaryReaderQuotasAreEqual(bindingElement.ReaderQuotas, new XmlDictionaryReaderQuotas()),
            "BinaryEncodingBindingElement_DefaultCtor: Assert property 'XmlDictionaryReaderQuotas' == default value failed.");
    }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:11,代码来源:BinaryMessageEncodingBindingElementTest.cs

示例10: CreateAndWriteMessage

 private void CreateAndWriteMessage(byte[] bytes) {
   using (var stream = new MemoryStream(bytes, false)) {
     var mebe = new BinaryMessageEncodingBindingElement();
     mebe.MessageVersion = MessageVersion.Soap12;
     mebe.ReaderQuotas.MaxArrayLength = XmlDictionaryReaderQuotas.Max.MaxArrayLength;
     mebe.ReaderQuotas.MaxDepth = XmlDictionaryReaderQuotas.Max.MaxDepth;
     mebe.ReaderQuotas.MaxStringContentLength = XmlDictionaryReaderQuotas.Max.MaxStringContentLength;
     var factory = mebe.CreateMessageEncoderFactory();
     var msg = factory.Encoder.ReadMessage(stream, 1024 * 16);     // I have no idea what header size to give it ...
     WriteMessage(msg);
   }
 }
开发者ID:IdeaBlade,项目名称:DevForce.Utilities,代码行数:12,代码来源:DevForceMessageInspector.cs

示例11: InitializeFrom

 private void InitializeFrom(NamedPipeTransportBindingElement namedPipe, BinaryMessageEncodingBindingElement encoding, TransactionFlowBindingElement context)
 {
     this.Initialize();
     this.HostNameComparisonMode = namedPipe.HostNameComparisonMode;
     this.MaxBufferPoolSize = namedPipe.MaxBufferPoolSize;
     this.MaxBufferSize = namedPipe.MaxBufferSize;
     this.MaxConnections = namedPipe.MaxPendingConnections;
     this.MaxReceivedMessageSize = namedPipe.MaxReceivedMessageSize;
     this.TransferMode = namedPipe.TransferMode;
     this.ReaderQuotas = encoding.ReaderQuotas;
     this.TransactionFlow = context.Transactions;
     this.TransactionProtocol = context.TransactionProtocol;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:NetNamedPipeBinding.cs

示例12: NetHttpBinding

        public NetHttpBinding(NetHttpSecurityMode securityMode)
        {
            if (securityMode != NetHttpSecurityMode.Transport &&
                securityMode != NetHttpSecurityMode.TransportCredentialOnly &&
                securityMode != NetHttpSecurityMode.None)
            {
                throw new ArgumentOutOfRangeException("securityMode");
            }

            this.securityMode = securityMode;   
            this.httpTransport = new HttpTransportBindingElement();
            this.httpsTransport = new HttpsTransportBindingElement();
            this.binaryEncoding = new BinaryMessageEncodingBindingElement();
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:14,代码来源:NetHttpBinding.cs

示例13: ChatServer

        public ChatServer()
        {
            BinaryMessageEncodingBindingElement element = new BinaryMessageEncodingBindingElement();
            MessageEncoder encoder = element.CreateMessageEncoderFactory().Encoder;

            MessageDeliveryFormatter formatter = new MessageDeliveryFormatter(new ConverterMessageDeliveryReaderFactory(encoder, typeof(IChatService)), new ConverterMessageDeliveryWriterFactory(encoder, typeof(IChatService)));
            _serviceBus = new ServiceBusRuntime(new DirectDeliveryCore() , new WcfManagementService());
            _serviceBus.AddListener(new ListenerEndpoint(Guid.NewGuid(), "Chat Service", "ChatServer", "http://localhost/chatServer", typeof(IChatService), new WcfServiceHostListener()));
            _serviceBus.Subscribe(new SubscriptionEndpoint(Guid.NewGuid(), "No subscribers", "ChatClient", "", typeof(IChatService), new MethodDispatcher(new UnhandledReplyHandler(_serviceBus)), new UnhandledMessageFilter(typeof(SendMessageRequest)), true));
            _serviceBus.UnhandledException+= (o, ex) =>
                {
                    Console.WriteLine("Unhandled Exception: "+ex.ExceptionObject);
                };
        }
开发者ID:jezell,项目名称:iserviceoriented,代码行数:14,代码来源:ChatServer.cs

示例14: Main

        static void Main(string[] args)
        {
            // TODO: extract into a properties file
            string serviceName = "CAService";
            string baseAddress = "net.tcp://localhost:3333/";
            ServiceHost caHost = new ServiceHost(typeof(Simulation), new Uri(baseAddress + serviceName));

            try {
                // Configure the TCP binding
                NetTcpBinding tcpBinding = new NetTcpBinding();
                tcpBinding.MaxReceivedMessageSize = Int32.MaxValue;
                tcpBinding.MaxBufferPoolSize = Int32.MaxValue;
                tcpBinding.ReaderQuotas.MaxArrayLength = Int32.MaxValue;

                // Configure a binary message encoding binding element
                BinaryMessageEncodingBindingElement binaryBinding = new BinaryMessageEncodingBindingElement();
                binaryBinding.ReaderQuotas.MaxArrayLength = Int32.MaxValue;
                binaryBinding.ReaderQuotas.MaxNameTableCharCount = Int32.MaxValue;
                binaryBinding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;

                // Configure a MEX TCP binding to send metadata
                CustomBinding mexBinding = new CustomBinding(MetadataExchangeBindings.CreateMexTcpBinding());
                mexBinding.Elements.Insert(0, binaryBinding);
                mexBinding.Elements.Find<TcpTransportBindingElement>().MaxReceivedMessageSize = Int32.MaxValue;

                // Configure the host
                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                caHost.Description.Behaviors.Add(smb);
                caHost.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, baseAddress + serviceName + "/mex");
                caHost.AddServiceEndpoint(typeof(ICAService), tcpBinding, baseAddress + serviceName);
                ServiceDebugBehavior debug = caHost.Description.Behaviors.Find<ServiceDebugBehavior>();
                if (debug == null) caHost.Description.Behaviors.Add(new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true });
                else if (!debug.IncludeExceptionDetailInFaults) debug.IncludeExceptionDetailInFaults = true;

                // Open the host and run until Enter is pressed
                caHost.Open();
                Console.WriteLine("CA Simulator Server is running. Press Enter to exit.");
                Console.ReadLine();
                caHost.Close();
            }
            catch (CommunicationException e) {
                Console.WriteLine(e.Message);
                caHost.Abort();
            }
            catch (InvalidOperationException e) {
                Console.WriteLine(e.Message);
                caHost.Abort();
            }
        }
开发者ID:JWCook,项目名称:Client-Server_CA_Sim,代码行数:50,代码来源:CAServer.cs

示例15: GeocachingLiveV6

        public GeocachingLiveV6(bool testSite)
        {

            BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
            {
                ReaderQuotas = new XmlDictionaryReaderQuotas()
                {
                    MaxStringContentLength = int.MaxValue,
                    MaxBytesPerRead = int.MaxValue,
                    MaxDepth = int.MaxValue,
                    MaxArrayLength = int.MaxValue
                }
            };

            HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
            {
                MaxBufferSize = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                AllowCookies = false,
                //UseDefaultWebProxy = true,
            };

            // add the binding elements into a Custom Binding
            CustomBinding binding = new CustomBinding(binaryMessageEncoding, httpTransport);

            EndpointAddress endPoint;
            if (testSite)
            {
                endPoint = new EndpointAddress("https://staging.api.groundspeak.com/Live/V6Beta/geocaching.svc/Silverlightsoap");
                _token = Core.Settings.Default.LiveAPITokenStaging;
            }
            else
            {
                endPoint = new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap");
                _token = Core.Settings.Default.LiveAPIToken;
            }

            try
            {
                _client = new LiveV6.LiveClient(binding, endPoint);
            }
            catch(Exception e)
            {
                Core.ApplicationData.Instance.Logger.AddLog(this, e);
            }

        }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:47,代码来源:GeocachingLive.cs


注:本文中的BinaryMessageEncodingBindingElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。