/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new NetNamedPipeBinding(); binding.TransferMode = args.TransferMode; //binding.Security.Mode = args.AuthenticationRequired ? NetNamedPipeSecurityMode.Transport : NetNamedPipeSecurityMode.None; //binding.Security.Transport.ProtectionLevel = args.AuthenticationRequired ? ProtectionLevel.EncryptAndSign : ProtectionLevel.None; // turn off transport security altogether //binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; //binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; //if (args.SendTimeoutSeconds > 0) // binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); // allow individual string content to be same size as entire message //binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; //binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return channelFactory; }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = WebServicesSettings.Default.SecurityMode; binding.Security.Message.ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None; binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; if (args.SendTimeoutSeconds > 0) { binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); } // allow individual string content to be same size as entire message binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; //binding.ReceiveTimeout = new TimeSpan(0, 0 , 20); //binding.SendTimeout = new TimeSpan(0, 0, 10); ChannelFactory channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; //TODO (Rockstar): remove this after refactoring to do per-sop edits foreach (var operation in channelFactory.Endpoint.Contract.Operations) { operation.Behaviors.Find <DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = args.MaxReceivedMessageSize; } return(channelFactory); }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new NetNamedPipeBinding(); //binding.Security.Mode = args.AuthenticationRequired ? NetNamedPipeSecurityMode.Transport : NetNamedPipeSecurityMode.None; //binding.Security.Transport.ProtectionLevel = args.AuthenticationRequired ? ProtectionLevel.EncryptAndSign : ProtectionLevel.None; // turn off transport security altogether //binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; //binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; //if (args.SendTimeoutSeconds > 0) // binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); // allow individual string content to be same size as entire message //binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; //binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return(channelFactory); }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new NetTcpBinding(); binding.Security.Mode = args.AuthenticationRequired ? SecurityMode.TransportWithMessageCredential : SecurityMode.Transport; binding.Security.Message.ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None; binding.TransferMode = args.TransferMode; // turn off transport security altogether binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; if (args.SendTimeoutSeconds > 0) { binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); } binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; // allow individual string content to be same size as entire message binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return(channelFactory); }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Message; binding.Security.Message.ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None; binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; if (args.SendTimeoutSeconds > 0) binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); // allow individual string content to be same size as entire message binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; //binding.ReceiveTimeout = new TimeSpan(0, 0 , 20); //binding.SendTimeout = new TimeSpan(0, 0, 10); var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; //TODO (Rockstar): remove this after refactoring to do per-sop edits foreach (var operation in channelFactory.Endpoint.Contract.Operations) operation.Behaviors.Find<DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = args.MaxReceivedMessageSize; return channelFactory; }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new NetTcpBinding(); binding.Security.Mode = args.AuthenticationRequired ? SecurityMode.TransportWithMessageCredential : SecurityMode.Transport; binding.Security.Message.ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None; // turn off transport security altogether binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; if (args.SendTimeoutSeconds > 0) binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; // allow individual string content to be same size as entire message binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return channelFactory; }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new NetTcpBinding { TransferMode = args.TransferMode, MaxReceivedMessageSize = args.TransferMode == TransferMode.Buffered ? Math.Min(int.MaxValue, args.MaxReceivedMessageSize) : args.MaxReceivedMessageSize, // allow individual string content to be same size as entire message ReaderQuotas = { MaxStringContentLength = (int)Math.Min(int.MaxValue, args.MaxReceivedMessageSize), MaxArrayLength = (int)Math.Min(int.MaxValue, args.MaxReceivedMessageSize) }, Security = { Mode = args.AuthenticationRequired ? SecurityMode.TransportWithMessageCredential : SecurityMode.Transport, Message = { ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None }, // turn off transport security altogether Transport = { ClientCredentialType = TcpClientCredentialType.None } } }; if (args.SendTimeoutSeconds > 0) { binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); } var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return(channelFactory); }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { var binding = new NetTcpBinding { TransferMode = args.TransferMode, MaxReceivedMessageSize = args.TransferMode == TransferMode.Buffered ? Math.Min(int.MaxValue, args.MaxReceivedMessageSize) : args.MaxReceivedMessageSize, // allow individual string content to be same size as entire message ReaderQuotas = { MaxStringContentLength = (int)Math.Min(int.MaxValue, args.MaxReceivedMessageSize), MaxArrayLength = (int)Math.Min(int.MaxValue, args.MaxReceivedMessageSize) }, Security = { Mode = args.AuthenticationRequired ? SecurityMode.TransportWithMessageCredential : SecurityMode.Transport, Message = { ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None }, // turn off transport security altogether Transport = { ClientCredentialType = TcpClientCredentialType.None } } }; if (args.SendTimeoutSeconds > 0) binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds); var channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return channelFactory; }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Message; binding.Security.Message.ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None; binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; // allow individual string content to be same size as entire message binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; //binding.ReceiveTimeout = new TimeSpan(0, 0 , 20); //binding.SendTimeout = new TimeSpan(0, 0, 10); ChannelFactory channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return channelFactory; }
/// <summary> /// Configures and returns an instance of the specified service channel factory, according to the specified arguments. /// </summary> /// <param name="args"></param> /// <returns></returns> public ChannelFactory ConfigureChannelFactory(ServiceChannelConfigurationArgs args) { WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = WebServicesSettings.Default.SecurityMode; binding.Security.Message.ClientCredentialType = args.AuthenticationRequired ? MessageCredentialType.UserName : MessageCredentialType.None; binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize; // allow individual string content to be same size as entire message binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize; binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize; //binding.ReceiveTimeout = new TimeSpan(0, 0 , 20); //binding.SendTimeout = new TimeSpan(0, 0, 10); ChannelFactory channelFactory = (ChannelFactory)Activator.CreateInstance(args.ChannelFactoryClass, binding, new EndpointAddress(args.ServiceUri)); channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = args.CertificateValidationMode; channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = args.RevocationMode; return(channelFactory); }