1. MaxOutboundConnectionsPerEndpoin属性确定可以在连接池中的最大连接数量。默认值是10.增加这个值将提高服务到服务环境或者多线程客户端通信环境的性能和可扩展性。
2. 修改MaxOutboundConnectionsPerEndpoin属性的值:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.ServiceModel;
- using System.ServiceModel.Channels;
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- NetTcpBinding binding = new NetTcpBinding();
- TcpTransportBindingElement tcptbe = new TcpTransportBindingElement();
- tcptbe.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint = 30;
- string count = tcptbe.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint.ToString();
- Console.Write("当前连接池中的最大连接数量为:" + count);
- Console.ReadLine();
- }
- }
- }