public static void Main() { //init queue if (!MessageQueue.Exists(Constants.QUEUE_PATH)) { MessageQueue.Create(Constants.QUEUE_PATH, true); } //init wcf host via code Uri baseUri = new Uri("http://localhost:7878/msmqsvc"); using (ServiceHost host = new ServiceHost(typeof(OrderProcessorService), baseUri)) { //add metadata behavior ServiceMetadataBehavior smb = new ServiceMetadataBehavior() { HttpGetEnabled = true }; host.Description.Behaviors.Add(smb); //add service endpoint MsmqIntegrationBinding binding = new MsmqIntegrationBinding(MsmqIntegrationSecurityMode.None); host.AddServiceEndpoint(typeof(ClassLib.IOrderProcessor), binding, "msmq.formatname:DIRECT=OS:" + Constants.QUEUE_PATH); host.Open(); // The service can now be accessed. Console.WriteLine("The service is ready."); Console.WriteLine("Press any key to terminate service."); Console.ReadLine(); host.Close(); } }
static void Run() { MsmqIntegrationBinding binding = new MsmqIntegrationBinding(); binding.Security.Mode = MsmqIntegrationSecurityMode.None; EndpointAddress address = new EndpointAddress("msmq.formatname:DIRECT=OS:" + Constants.QUEUE_PATH); ChannelFactory <ClassLib.IOrderProcessor> channelFactory = new ChannelFactory <ClassLib.IOrderProcessor>(binding, address); try { ClassLib.IOrderProcessor channel = channelFactory.CreateChannel(); MyOrder order = new MyOrder(); order.ID = DateTime.Now.Ticks.ToString(); order.Name = "Order_" + order.ID; MsmqMessage <MyOrder> ordermsg = new MsmqMessage <MyOrder>(order); using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { channel.SubmitPurchaseOrderInMessage(ordermsg); scope.Complete(); } Console.WriteLine("Order has been submitted:{0}", ordermsg); } finally { channelFactory.Close(); } }
protected override void OnApplyConfiguration(Binding binding) { base.OnApplyConfiguration(binding); MsmqIntegrationBinding miBinding = (MsmqIntegrationBinding)binding; miBinding.SerializationFormat = this.SerializationFormat; this.Security.ApplyConfiguration(miBinding.Security); }
private static Binding GetMsmqIntegrationBinding() { var binding = new MsmqIntegrationBinding(); binding.MaxReceivedMessageSize = int.MaxValue; binding.Security.Mode = MsmqIntegrationSecurityMode.None; return(binding); }
protected internal override void InitializeFrom(Binding binding) { base.InitializeFrom(binding); MsmqIntegrationBinding binding2 = (MsmqIntegrationBinding)binding; this.SerializationFormat = binding2.SerializationFormat; this.Security.InitializeFrom(binding2.Security); }
protected internal override void InitializeFrom(Binding binding) { base.InitializeFrom(binding); MsmqIntegrationBinding miBinding = (MsmqIntegrationBinding)binding; SetPropertyValueIfNotDefaultValue(ConfigurationStrings.SerializationFormat, miBinding.SerializationFormat); this.Security.InitializeFrom(miBinding.Security); }
public static Binding CreateBinding(string bindingName) { Binding result = null; try { if (string.Compare(bindingName, typeof(WSHttpBinding).FullName, true) == 0) { result = new WSHttpBinding(); } else if (string.Compare(bindingName, typeof(WS2007HttpBinding).FullName, true) == 0) { result = new WS2007HttpBinding(); } else if (string.Compare(bindingName, typeof(BasicHttpBinding).FullName, true) == 0) { result = new BasicHttpBinding(); } else if (string.Compare(bindingName, typeof(WSDualHttpBinding).FullName, true) == 0) { result = new WSDualHttpBinding(); } else if (string.Compare(bindingName, typeof(WS2007FederationHttpBinding).FullName, true) == 0) { result = new WS2007FederationHttpBinding(); } else if (string.Compare(bindingName, typeof(WSFederationHttpBinding).FullName, true) == 0) { result = new WSFederationHttpBinding(); } else if (string.Compare(bindingName, typeof(NetNamedPipeBinding).FullName, true) == 0) { result = new NetNamedPipeBinding(); } else if (string.Compare(bindingName, typeof(NetMsmqBinding).FullName, true) == 0) { result = new NetMsmqBinding(); } else if (string.Compare(bindingName, typeof(MsmqIntegrationBinding).FullName, true) == 0) { result = new MsmqIntegrationBinding(); } else if (string.Compare(bindingName, typeof(NetTcpBinding).FullName, true) == 0) { result = new NetTcpBinding(); } else if (string.Compare(bindingName, typeof(NetPeerTcpBinding).FullName, true) == 0) { result = new NetPeerTcpBinding(); } } catch { result = new BasicHttpBinding(BasicHttpSecurityMode.None); } return(result); }
/// <summary> /// Configures the specified binding. /// </summary> /// <param name="binding">The binding.</param> /// <returns>Binding.</returns> public virtual Binding Configure( MsmqIntegrationBinding binding) { if (binding == null) { throw new ArgumentNullException(nameof(binding)); } return(ConfigureDefault(binding)); }
public void WriteToQueue() { //var address =new EndpointAddress(@"msmq.formatname:DIRECT=OS:.\private$\olo"); var address = new EndpointAddress(@"msmq.formatname:.\private$\olo"); MsmqIntegrationBinding binding = new MsmqIntegrationBinding(); using (var processor = new OrderProcessorClient(binding, address)) { using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { processor.SendMessage(new MsmqMessage <string>("JurasBuras2")); scope.Complete(); } } }
public static void Snippet2() { // <Snippet2> MsmqIntegrationBinding binding = new MsmqIntegrationBinding(); EndpointAddress address = new EndpointAddress("msmq.formatname:DIRECT=OS:.\\private$\\Orders"); ChannelFactory <IOrderProcessor> channelFactory = new ChannelFactory <IOrderProcessor>(binding, address); IOrderProcessor channel = channelFactory.CreateChannel(); PurchaseOrder po = new PurchaseOrder(); po.customerId = "somecustomer.com"; po.poNumber = Guid.NewGuid().ToString(); PurchaseOrderLineItem lineItem1 = new PurchaseOrderLineItem(); lineItem1.productId = "Blue Widget"; lineItem1.quantity = 54; lineItem1.unitCost = 29.99F; PurchaseOrderLineItem lineItem2 = new PurchaseOrderLineItem(); lineItem2.productId = "Red Widget"; lineItem2.quantity = 890; lineItem2.unitCost = 45.89F; po.orderLineItems = new PurchaseOrderLineItem[2]; po.orderLineItems[0] = lineItem1; po.orderLineItems[1] = lineItem2; MsmqMessage <PurchaseOrder> ordermsg = new MsmqMessage <PurchaseOrder>(po); using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { channel.SubmitPurchaseOrder(ordermsg); scope.Complete(); } Console.WriteLine("Order has been submitted:{0}", po); // </Snippet2> }
public static void RaiseEvent() { var id = Guid.NewGuid(); Console.WriteLine("Raising event with id = " + id + " ..."); foreach (var subscriber in Subscribers) { Console.WriteLine("\tSending event to-> " + subscriber); var binding = new MsmqIntegrationBinding(); binding.Durable = false; binding.ExactlyOnce = false; binding.Security.Mode = MsmqIntegrationSecurityMode.None; binding.SerializationFormat = MsmqMessageSerializationFormat.Xml; binding.UseMsmqTracing = true; var channel = ChannelFactory <IEventCallback> .CreateChannel(binding, new EndpointAddress(subscriber)); channel.Raise(new MsmqMessage <Guid>(id)); Console.WriteLine("\tEvent sent!"); } }
public static void Snippet4() { MsmqIntegrationBinding binding = new MsmqIntegrationBinding(); binding.SerializationFormat = MsmqMessageSerializationFormat.Binary; }
public static void Snippet5() { // <Snippet5> MsmqIntegrationBinding binding = new MsmqIntegrationBinding(MsmqIntegrationSecurityMode.Transport); // </Snippet5> }
public static void Snippet3() { // <Snippet3> MsmqIntegrationBinding binding = new MsmqIntegrationBinding("MyBindingConfig"); // </Snippet3> }
/// <summary> /// Creates the appropriate binding type for the given element /// </summary> /// <param name="endPoint">Enpoint to create binding object for</param> /// <returns>Binding represented in the config file</returns> private static Binding GetBinding(ChannelEndpointElement endPoint) { Binding binding = null; try { switch (endPoint.Binding) { case "basicHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new BasicHttpBinding(endPoint.BindingConfiguration); } else { binding = new BasicHttpBinding(); } break; case "basicHttpContextBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new BasicHttpContextBinding(endPoint.BindingConfiguration); } else { binding = new BasicHttpContextBinding(); } break; case "customBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new CustomBinding(endPoint.BindingConfiguration); } else { binding = new CustomBinding(); } break; case "netNamedPipeBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetNamedPipeBinding(endPoint.BindingConfiguration); } else { binding = new NetNamedPipeBinding(); } break; case "netPeerTcpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetPeerTcpBinding(endPoint.BindingConfiguration); } else { binding = new NetPeerTcpBinding(); } break; case "netTcpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetTcpBinding(endPoint.BindingConfiguration); } else { binding = new NetTcpBinding(); } break; case "netTcpContextBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetTcpContextBinding(endPoint.BindingConfiguration); } else { binding = new NetTcpContextBinding(); } break; case "webHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WebHttpBinding(endPoint.BindingConfiguration); } else { binding = new WebHttpBinding(); } break; case "ws2007HttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WS2007HttpBinding(endPoint.BindingConfiguration); } else { binding = new WS2007HttpBinding(); } break; case "wsHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WSHttpBinding(endPoint.BindingConfiguration); } else { binding = new WSHttpBinding(); } break; case "wsHttpContextBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WSHttpContextBinding(endPoint.BindingConfiguration); } else { binding = new WSHttpContextBinding(); } break; case "wsDualHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WSDualHttpBinding(endPoint.BindingConfiguration); } else { binding = new WSDualHttpBinding(); } break; case "wsFederationHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WSFederationHttpBinding(endPoint.BindingConfiguration); } else { binding = new WSFederationHttpBinding(); } break; case "ws2007FederationHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new WS2007FederationHttpBinding(endPoint.BindingConfiguration); } else { binding = new WS2007FederationHttpBinding(); } break; case "msmqIntegrationBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new MsmqIntegrationBinding(endPoint.BindingConfiguration); } else { binding = new MsmqIntegrationBinding(); } break; case "netMsmqBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetMsmqBinding(endPoint.BindingConfiguration); } else { binding = new NetMsmqBinding(); } break; case "netHttpBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetHttpBinding(endPoint.BindingConfiguration); } else { binding = new NetHttpBinding(); } break; case "netHttpsBinding": if (!string.IsNullOrEmpty(endPoint.BindingConfiguration)) { binding = new NetHttpsBinding(endPoint.BindingConfiguration); } else { binding = new NetHttpBinding(); } break; } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Namespace + "." + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); throw ex; } return(binding); }
/// <summary> /// Configures the specified binding. /// </summary> /// <param name="binding">The binding.</param> /// <returns>Binding.</returns> public override Binding Configure( MsmqIntegrationBinding binding) { IncompatibleBinding(binding); return(binding); }
/// <summary> /// Creates the binding from key. /// </summary> /// <param name="key">The key.</param> /// <returns></returns> public static Binding CreateBindingFromKey(string key) { switch (key) { case Key.BasicWinHttpBinding: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); bnd.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; bnd.Upscale(); return(bnd); }; case Key.WsWinHttpBinding: { var bnd = new WSHttpBinding(SecurityMode.Transport); bnd.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; bnd.Upscale(); return(bnd); } case Key.BasicHttpBindingNoSecurity: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.None); bnd.Upscale(); return(bnd); } case Key.BasicHttpBindingMessageSecurity: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.Message); bnd.Upscale(); return(bnd); } case Key.BasicHttpBindingTransportSecurity: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.Transport); bnd.Upscale(); return(bnd); } case Key.BasicHttpBindingTransportOnlySecurity: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); bnd.Upscale(); return(bnd); } case Key.BasicHttpBindingTransportWithMessageSecurity: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential); bnd.Upscale(); return(bnd); } case Key.MsmqIntegrationBinding: { var bnd = new MsmqIntegrationBinding(); bnd.Upscale(); return(bnd); } case Key.NetMsmqBinding: { var bnd = new NetMsmqBinding(); bnd.Upscale(); return(bnd); } case Key.NetNamedPipeBinding: { // var bnd = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); var bnd = new NetNamedPipeBinding(); bnd.Upscale(); return(bnd); } case Key.UnsecureNetMsmqBinding: { var bnd = new NetMsmqBinding(NetMsmqSecurityMode.None); bnd.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None; bnd.Security.Transport.MsmqProtectionLevel = ProtectionLevel.None; bnd.Security.Message.ClientCredentialType = MessageCredentialType.None; bnd.Upscale(); return(bnd); } case Key.NetTcpBinding: { var bnd = new NetTcpBinding(); bnd.Upscale(); return(bnd); } case Key.WebHttpBinding: { var bnd = new WebHttpBinding(); bnd.Upscale(); return(bnd); } case Key.Ws2007FederationHttpBinding: { var bnd = new WS2007FederationHttpBinding(); bnd.Upscale(); return(bnd); } case Key.Ws2007HttpBinding: { var bnd = new WS2007HttpBinding(); bnd.Upscale(); return(bnd); }; case Key.WsDualHttpBinding: { var bnd = new WSDualHttpBinding(); bnd.Upscale(); return(bnd); } case Key.WsFederationHttpBinding: { var bnd = new WSFederationHttpBinding(); bnd.Upscale(); return(bnd); } case Key.CustomValidationWsHttpBindingTransportAndMessage: { //http://www.codeproject.com/Articles/59927/WCF-Service-over-HTTPS-with-custom-username-and-pa var bnd = new WSHttpBinding(SecurityMode.TransportWithMessageCredential); bnd.Security.Message.ClientCredentialType = MessageCredentialType.UserName; bnd.Upscale(); return(bnd); } case Key.CustomValidationWsHttpBindingMessage: { //http://www.codeproject.com/Articles/59927/WCF-Service-over-HTTPS-with-custom-username-and-pa var bnd = new WSHttpBinding(SecurityMode.Message); bnd.Security.Message.ClientCredentialType = MessageCredentialType.UserName; bnd.Upscale(); return(bnd); } case Key.CustomValidationBasicHttpBindingTransportAndMessage: { var bnd = new BasicHttpBinding((BasicHttpSecurityMode.TransportWithMessageCredential)); bnd.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; bnd.Upscale(); return(bnd); } case Key.CustomValidationBasicHttpBindingMessage: { var bnd = new BasicHttpBinding((BasicHttpSecurityMode.Message)); bnd.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; bnd.Upscale(); return(bnd); } case Key.WsHttpBindingMessageSecurity: { var bnd = new WSHttpBinding(SecurityMode.Message); bnd.Upscale(); return(bnd); } case Key.WsHttpBindingTransportSecurity: { var bnd = new WSHttpBinding(SecurityMode.Transport); bnd.Upscale(); return(bnd); } case Key.WsHttpBindingTransportWithMessageSecurity: { var bnd = new WSHttpBinding(SecurityMode.TransportWithMessageCredential); bnd.Upscale(); return(bnd); } case Key.WsHttpBindingNoSecurity: { var bnd = new WSHttpBinding(SecurityMode.None); bnd.Upscale(); return(bnd); } default: { var bnd = new BasicHttpBinding(BasicHttpSecurityMode.None); bnd.Upscale(); return(bnd); } } }
private static Binding FindBinding(BindingType bType) { switch (bType) { case BindingType.WebHttp: WebHttpBinding webHttpBinding = new WebHttpBinding(); webHttpBinding.UseDefaultWebProxy = false; webHttpBinding.Security.Mode = WebHttpSecurityMode.None; webHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; webHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; webHttpBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; webHttpBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; webHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; webHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; return(webHttpBinding); case BindingType.BasicHttp: BasicHttpBinding basicHttpBinding = new BasicHttpBinding(); basicHttpBinding.UseDefaultWebProxy = false; basicHttpBinding.Security.Mode = BasicHttpSecurityMode.None; basicHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; basicHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; basicHttpBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; basicHttpBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; basicHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; basicHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; return(basicHttpBinding); case BindingType.MsmqIntegration: MsmqIntegrationBinding msmqIntegrationBinding = new MsmqIntegrationBinding(); msmqIntegrationBinding.ExactlyOnce = false; msmqIntegrationBinding.UseSourceJournal = true; msmqIntegrationBinding.Security.Mode = MsmqIntegrationSecurityMode.None; msmqIntegrationBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; return(msmqIntegrationBinding); case BindingType.MsmqIntegrationForPubsub: MsmqIntegrationBinding msmqIntegrationForPubsubBinding = new MsmqIntegrationBinding(); msmqIntegrationForPubsubBinding.ExactlyOnce = false; msmqIntegrationForPubsubBinding.UseSourceJournal = true; msmqIntegrationForPubsubBinding.Security.Mode = MsmqIntegrationSecurityMode.Transport; msmqIntegrationForPubsubBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.WindowsDomain; msmqIntegrationForPubsubBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; return(msmqIntegrationForPubsubBinding); case BindingType.NetMsmq: NetMsmqBinding netMsmqBinding = new NetMsmqBinding(); //netMsmqBinding.ReaderQuotas.MaxStringContentLength = serviceClient.ReaderQuotasMaxStringContentLength; netMsmqBinding.ExactlyOnce = false; netMsmqBinding.UseSourceJournal = true; netMsmqBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; netMsmqBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; netMsmqBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; netMsmqBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; netMsmqBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; netMsmqBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; //if (credentialType.HasValue) //{ // netMsmqBinding.Security.Mode = NetMsmqSecurityMode.Message; // netMsmqBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value); // netMsmqBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; //} return(netMsmqBinding); case BindingType.NetTcp: NetTcpBinding netTcpBinding = new NetTcpBinding(); //netTcpBinding.ReaderQuotas.MaxStringContentLength = serviceClient.ReaderQuotasMaxStringContentLength; //netTcpBinding.ReliableSession.Enabled = serviceClient.ReliableSessionEnabled; //netTcpBinding.ReliableSession.Ordered = serviceClient.ReliableSessionOrdered; netTcpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; netTcpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; netTcpBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; netTcpBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; netTcpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; netTcpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; //if (credentialType.HasValue) //{ // netTcpBinding.Security.Mode = SecurityMode.Message; // netTcpBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value); // netTcpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; //} return(netTcpBinding); case BindingType.NetNamedPipe: NetNamedPipeBinding netNamedPipeBinding = new NetNamedPipeBinding(); netNamedPipeBinding.Security.Mode = NetNamedPipeSecurityMode.None; netNamedPipeBinding.TransactionFlow = false; //netNamedPipeBinding.MaxConnections = 100; netNamedPipeBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; netNamedPipeBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; netNamedPipeBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; netNamedPipeBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; netNamedPipeBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; netNamedPipeBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; return(netNamedPipeBinding); case BindingType.WSDualHttp: WSDualHttpBinding wsDualHttpBinding = new WSDualHttpBinding(); //wsDualHttpBinding.ReaderQuotas.MaxStringContentLength = serviceClient.ReaderQuotasMaxStringContentLength; wsDualHttpBinding.UseDefaultWebProxy = false; //wsDualHttpBinding.ReliableSession.Ordered = serviceClient.ReliableSessionOrdered; wsDualHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; wsDualHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; wsDualHttpBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; wsDualHttpBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; wsDualHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; wsDualHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; //if (credentialType.HasValue) //{ // wsDualHttpBinding.Security.Mode = WSDualHttpSecurityMode.Message; // wsDualHttpBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value); // wsDualHttpBinding.Security.Message.NegotiateServiceCredential = true; // wsDualHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; //} return(wsDualHttpBinding); default: WSHttpBinding wsHttpBinding = new WSHttpBinding(); wsHttpBinding.UseDefaultWebProxy = false; //wsHttpBinding.ReliableSession.Enabled = serviceClient.ReliableSessionEnabled; //wsHttpBinding.ReliableSession.Ordered = serviceClient.ReliableSessionOrdered; wsHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE; wsHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE; wsHttpBinding.ReaderQuotas.MaxArrayLength = MAX_MSG_SIZE; wsHttpBinding.ReaderQuotas.MaxBytesPerRead = MAX_MSG_SIZE; wsHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE; wsHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE; wsHttpBinding.ReceiveTimeout = new TimeSpan(23, 59, 59); //if (credentialType.HasValue) //{ // wsHttpBinding.Security.Mode = SecurityMode.Message; // wsHttpBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value); // wsHttpBinding.Security.Message.NegotiateServiceCredential = true; // wsHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; // wsHttpBinding.Security.Message.EstablishSecurityContext = true; //} return(wsHttpBinding); } }