public MessageServiceProxy() { this.m_BasicHttpBinding = new BasicHttpBinding(); this.m_EndpointAddress = new EndpointAddress(EndpointAddressUrl); this.m_BasicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; this.m_BasicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; this.m_BasicHttpBinding.MaxReceivedMessageSize = 2147483647; XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas(); readerQuotas.MaxArrayLength = 25 * 208000; readerQuotas.MaxStringContentLength = 25 * 208000; this.m_BasicHttpBinding.ReaderQuotas = readerQuotas; this.m_ChannelFactory = new ChannelFactory <YellowstonePathology.YpiConnect.Contract.IMessageService>(this.m_BasicHttpBinding, this.m_EndpointAddress); this.m_ChannelFactory.Credentials.UserName.UserName = YellowstonePathology.YpiConnect.Contract.Identity.GuestWebServiceAccount.UserName; this.m_ChannelFactory.Credentials.UserName.Password = YellowstonePathology.YpiConnect.Contract.Identity.GuestWebServiceAccount.Password; foreach (System.ServiceModel.Description.OperationDescription op in this.m_ChannelFactory.Endpoint.Contract.Operations) { var dataContractBehavior = op.Behaviors.Find <System.ServiceModel.Description.DataContractSerializerOperationBehavior>(); if (dataContractBehavior != null) { dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue; } } this.m_Channel = this.m_ChannelFactory.CreateChannel(); }
public MessageServiceProxy() { this.m_BasicHttpBinding = new BasicHttpBinding(); this.m_EndpointAddress = new EndpointAddress(EndpointAddressUrl); this.m_BasicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; this.m_BasicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; this.m_BasicHttpBinding.MaxReceivedMessageSize = 2147483647; XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas(); readerQuotas.MaxArrayLength = 25 * 208000; readerQuotas.MaxStringContentLength = 25 * 208000; this.m_BasicHttpBinding.ReaderQuotas = readerQuotas; this.m_ChannelFactory = new ChannelFactory<YellowstonePathology.YpiConnect.Contract.IMessageService>(this.m_BasicHttpBinding, this.m_EndpointAddress); this.m_ChannelFactory.Credentials.UserName.UserName = YellowstonePathology.YpiConnect.Contract.Identity.GuestWebServiceAccount.UserName; this.m_ChannelFactory.Credentials.UserName.Password = YellowstonePathology.YpiConnect.Contract.Identity.GuestWebServiceAccount.Password; foreach (System.ServiceModel.Description.OperationDescription op in this.m_ChannelFactory.Endpoint.Contract.Operations) { var dataContractBehavior = op.Behaviors.Find<System.ServiceModel.Description.DataContractSerializerOperationBehavior>(); if (dataContractBehavior != null) { dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue; } } this.m_Channel = this.m_ChannelFactory.CreateChannel(); }