求助一个WCF问题
用WCF写了一个程序,服务端是自托管的,服务模式用的是Session,NetTcpBinding,代码如下:
public static class BindingUtility
{
public static TimeSpan CloseTimeout = TimeSpan.FromMinutes(2);
public static TimeSpan OpenTimeout = TimeSpan.FromMinutes(2);
public static TimeSpan SendTimeout = TimeSpan.FromMinutes(5);
public static TimeSpan ReceiveTimeout = TimeSpan.FromHours(1);
public static TimeSpan InactivityTimeout = TimeSpan.FromSeconds(1);
public static System.ServiceModel.NetTcpBinding CreateNetTcpBinding()
{
return new System.ServiceModel.NetTcpBinding()
{
CloseTimeout = BindingUtility.CloseTimeout,
OpenTimeout = BindingUtility.OpenTimeout,
SendTimeout = BindingUtility.SendTimeout,
ReceiveTimeout = BindingUtility.ReceiveTimeout,
TransactionFlow = false,
TransferMode = TransferMode.Buffered,
MaxBufferPoolSize = int.MaxValue,
MaxBufferSize = int.MaxValue,
MaxConnections = 30,
ListenBacklog = 30,
MaxReceivedMessageSize = int.MaxValue,
ReliableSession = new OptionalReliableSession()
{
Ordered = true,
InactivityTimeout = BindingUtility.InactivityTimeout,
Enabled = true
},
ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
{
MaxDepth = 128,
MaxStringContentLength = int.MaxValue,
MaxArrayLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxNameTableCharCount = int.MaxValue
},
Security = new NetTcpSecurity()
{
Mode = SecurityMode.None
}
};
}
}