在最近的开发中,总是发现人数一多就会有用户莫名其妙的界面卡死,或者直接掉线的情况,不知道是什么原因,由于项目采用的是netTcp绑定,猜想可能是并发连接的问题。于是查了一下:
在windows7中,并发连接数默认是10
代码<binding name="netTcpBindConfig" closeTimeout="00:30:00"
openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
maxReceivedMessageSize="2147483647">
openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
maxReceivedMessageSize="2147483647">
将项目移植到windows server2008上之后,并发连接数需要改变一下,于是变成
代码<binding name="netTcpBindConfig" closeTimeout="00:30:00"
openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="1000"
maxReceivedMessageSize="2147483647">
openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="1000"
maxReceivedMessageSize="2147483647">
但是问题依然存在,就想到是不是需要配置一下行为,于是将行为的连接数量也改变了
代码<behavior name="JXSoft.JPlan.WCFService.Behavior" >
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000"/>
<serviceMetadata/>
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000"/>
<serviceMetadata/>
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
问题解决,没有再出现过卡死或者掉线情况.
来源:https://www.cnblogs.com/wengyuli/archive/2010/12/27/1918109.html