public void NetHttpWebSocketsBufferedTransferMode() { string testString = new string('a', 3000); IWebHost host = ServiceHelper.CreateWebHostBuilder <Startup>(_output).Build(); using (host) { System.ServiceModel.ChannelFactory <ClientContract.IEchoService> factory = null; ClientContract.IEchoService channel = null; host.Start(); try { System.ServiceModel.NetHttpBinding binding = ClientHelper.GetBufferedModeWebSocketBinding(); factory = new System.ServiceModel.ChannelFactory <ClientContract.IEchoService>(binding, new System.ServiceModel.EndpointAddress(new Uri(NetHttpBufferedServiceUri))); channel = factory.CreateChannel(); ((IChannel)channel).Open(); string result = channel.EchoString(testString); Assert.Equal(testString, result); ((IChannel)channel).Close(); factory.Close(); } finally { ServiceHelper.CloseServiceModelObjects((IChannel)channel, factory); } } }
private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) { if ((endpointConfiguration == EndpointConfiguration.NetHttpBinding_IOrderService)) { System.ServiceModel.NetHttpBinding result = new System.ServiceModel.NetHttpBinding(); result.MaxBufferSize = int.MaxValue; result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; result.MaxReceivedMessageSize = int.MaxValue; result.AllowCookies = true; return(result); } throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); }