贴错了
上面的是客户端的配置
如下才是服务端的配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings >
<add key="ConnenctionString" value ="server= localhost;database=GxckIMDB;uid=sa;pwd=1687456hhs"/>
<add key="ADRoot" value ="LDAP://ou=三环集团,ou=users,ou=users and groups,ou=service clients,dc=sanhuan,dc=com"/>
<add key="ScanDBTime" value ="10"/><!--此数据是设定扫描数据库获得新版本组织结构的时间段,单位为每分钟,默认设定为10分钟-->
<add key="admin" value ="gxkcadmin"/>
<add key="pwd" value ="$yejc97xu5a3v@SH"/>
</appSettings>
<system.serviceModel >
<services >
<service name ="ServiceHosts.ChatService">
<!--<endpoint binding ="netTcpBinding" contract ="Contracts.IChatService"></endpoint>-->
<endpoint binding="netTcpBinding" bindingConfiguration ="net" contract ="Contracts.IChatService"></endpoint>
<host >
<baseAddresses >
<add baseAddress ="net.tcp://localhost:1985/myChatServer"/>
</baseAddresses>
</host>
</service>
</services>
<bindings >
<netTcpBinding >
<binding name="net" maxConnections ="10000">
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
上面的是客户端的配置
如下才是服务端的配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings >
<add key="ConnenctionString" value ="server= localhost;database=GxckIMDB;uid=sa;pwd=1687456hhs"/>
<add key="ADRoot" value ="LDAP://ou=三环集团,ou=users,ou=users and groups,ou=service clients,dc=sanhuan,dc=com"/>
<add key="ScanDBTime" value ="10"/><!--此数据是设定扫描数据库获得新版本组织结构的时间段,单位为每分钟,默认设定为10分钟-->
<add key="admin" value ="gxkcadmin"/>
<add key="pwd" value ="$yejc97xu5a3v@SH"/>
</appSettings>
<system.serviceModel >
<services >
<service name ="ServiceHosts.ChatService">
<!--<endpoint binding ="netTcpBinding" contract ="Contracts.IChatService"></endpoint>-->
<endpoint binding="netTcpBinding" bindingConfiguration ="net" contract ="Contracts.IChatService"></endpoint>
<host >
<baseAddresses >
<add baseAddress ="net.tcp://localhost:1985/myChatServer"/>
</baseAddresses>
</host>
</service>
</services>
<bindings >
<netTcpBinding >
<binding name="net" maxConnections ="10000">
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
不知为何,双工服务在联接上以后如果长时间Server没有回调Client就会出现你说的那问题。
我们写了一个空方法在Server端每隔30秒回调一次就可以了。
默认情况下,服务最多只能有 10 个并发会话。 因此,如果服务绑定使用会话,则服务将接受新的客户端连接,直到到达该数目;之后,它将拒绝新的客户端连接,直到当前会话之一结束。 可以通过多种方式支持更多的客户端。 如果您的服务不要求会话,则不要使用会话绑定。 (有关更多信息,请参见使用会话。) 另一种选择是增大会话限制,方法是将 MaxConcurrentSessions 属性的值更改为适合您环境的数字。