我win 7系统开发WCF程序在WIN7上系统上。客户端能送信息接收信,但在XP系统上跑服务端能接收到客户端发送信息 但从服务端发送到客户端,客户端接收不到信息。没有报任何错误。
服务端配制
<configuration> <appSettings> <!--提供服务的通信协议、地址、端口、目录--> <!--通信协议:net.tcp 、http 、--> <add key="addr" value="net.tcp://localhost:22222/SendService" /> <add key="ConnectionString" value="Database=PVM;Data Source=127.0.0.1;User id=root;Password=sa;charset=utf8;"/> </appSettings> <system.serviceModel> <services> <!--服务名 = <命名空间>.<程序集名称>--> <!--behaviorConfiguration 性能配置自定一个名称,<serviceBehaviors> 下的项对应此名称--> <service name="TransServer.SendService" behaviorConfiguration="MyBehavior"> <!--终节点--> <!--binding 绑定类型,NetTcpBinding、WSDualHttpBinding、WSHttpBindingBase、BasicHttpBinding、NetNamedPipeBinding、NetPeerTcpBinding、MsmqBindingBase、NetPeerTcpBinding、WebHttpBinding、MailBindingBase、CustomBinding--> <!--DuplexBinding 双工--> <!--使用契约:<命名空间>.<接口名称>--> <endpoint address="" binding="netTcpBinding" bindingConfiguration="DuplexBinding" contract="TransServer.ISendService" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MyBehavior"> <!--会话最大数量--> <serviceThrottling maxConcurrentSessions="10000" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <netTcpBinding> <!--双工,超时设置--> <binding name="DuplexBinding" sendTimeout="00:00:05"> <!--可靠会话--> <reliableSession enabled="true" /> <!--安全模式--> <security mode="None" /> </binding> </netTcpBinding> </bindings> </system.serviceModel> </configuration>
客户端配制:
<system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBinding_ISendService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true" /> <security mode="None"> <!--<transport clientCredentialType="Windows" protectionLevel="None" /> <message clientCredentialType="Windows" />--> </security> </binding> </netTcpBinding> </bindings> <client> <endpoint address="net.tcp://localhost:22222/SendService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ISendService" contract="SendSerivce.ISendService" name="NetTcpBinding_ISendService" /> </client> </system.serviceModel>