<!--服务器端的配置如下: -->
< services >
< service name = " SQS.Demo.Server.Ticket " behaviorConfiguration = " TicketBehavior " >
< endpoint address = " TicketService " binding = " netTcpBinding " bindingConfiguration = " TicketBindingConfiguration " contract = " SQS.Demo.Contract.ITicket " />
< endpoint address = " mex " contract = " IMetadataExchange " binding = " mexTcpBinding " />
< host >
< baseAddresses >
< add baseAddress = " net.tcp://192.168.20.114:9001 " />
</ baseAddresses >
</ host >
</ service >
< service name = " SQS.Demo.Server.Hotel " behaviorConfiguration = " TicketBehavior " >
< endpoint address = " HotelService " binding = " netTcpBinding " bindingConfiguration = " TicketBindingConfiguration " contract = " SQS.Demo.Contract.IHotel " />
< endpoint address = " hotel " contract = " IMetadataExchange " binding = " mexTcpBinding " />
< host >
< baseAddresses >
< add baseAddress = " net.tcp://192.168.20.114:9001 " />
</ baseAddresses >
</ host >
</ service >
</ services >
< behaviors >
< serviceBehaviors >
< behavior name = " TicketBehavior " >
< serviceThrottling maxConcurrentCalls = " 5000 " maxConcurrentSessions = " 5000 " maxConcurrentInstances = " 5000 " />
< serviceMetadata httpGetEnabled = " false " />
< serviceDebug includeExceptionDetailInFaults = " true " />
</ behavior >
</ serviceBehaviors >
</ behaviors >
< bindings >
< netTcpBinding >
< binding name = " TicketBindingConfiguration " openTimeout = " 00:30:00 " receiveTimeout = " 00:30:00 " sendTimeout = " 00:30:00 " maxBufferSize = " 2147483647 " maxReceivedMessageSize = " 2147483647 " >
< security mode = " None " />
< readerQuotas maxStringContentLength = " 6553600 " maxArrayLength = " 6553600 " />
</ binding >
</ netTcpBinding >
</ bindings >
<!--客服端的配置如下:-->
<client>
<endpoint address="net.tcp://192.168.20.114:9001/TicketService"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_TicketService1"
contract="ServiceTicket.TicketService" name="NetTcpBinding_TicketService1" />
< services >
< service name = " SQS.Demo.Server.Ticket " behaviorConfiguration = " TicketBehavior " >
< endpoint address = " TicketService " binding = " netTcpBinding " bindingConfiguration = " TicketBindingConfiguration " contract = " SQS.Demo.Contract.ITicket " />
< endpoint address = " mex " contract = " IMetadataExchange " binding = " mexTcpBinding " />
< host >
< baseAddresses >
< add baseAddress = " net.tcp://192.168.20.114:9001 " />
</ baseAddresses >
</ host >
</ service >
< service name = " SQS.Demo.Server.Hotel " behaviorConfiguration = " TicketBehavior " >
< endpoint address = " HotelService " binding = " netTcpBinding " bindingConfiguration = " TicketBindingConfiguration " contract = " SQS.Demo.Contract.IHotel " />
< endpoint address = " hotel " contract = " IMetadataExchange " binding = " mexTcpBinding " />
< host >
< baseAddresses >
< add baseAddress = " net.tcp://192.168.20.114:9001 " />
</ baseAddresses >
</ host >
</ service >
</ services >
< behaviors >
< serviceBehaviors >
< behavior name = " TicketBehavior " >
< serviceThrottling maxConcurrentCalls = " 5000 " maxConcurrentSessions = " 5000 " maxConcurrentInstances = " 5000 " />
< serviceMetadata httpGetEnabled = " false " />
< serviceDebug includeExceptionDetailInFaults = " true " />
</ behavior >
</ serviceBehaviors >
</ behaviors >
< bindings >
< netTcpBinding >
< binding name = " TicketBindingConfiguration " openTimeout = " 00:30:00 " receiveTimeout = " 00:30:00 " sendTimeout = " 00:30:00 " maxBufferSize = " 2147483647 " maxReceivedMessageSize = " 2147483647 " >
< security mode = " None " />
< readerQuotas maxStringContentLength = " 6553600 " maxArrayLength = " 6553600 " />
</ binding >
</ netTcpBinding >
</ bindings >
<!--客服端的配置如下:-->
<client>
<endpoint address="net.tcp://192.168.20.114:9001/TicketService"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_TicketService1"
contract="ServiceTicket.TicketService" name="NetTcpBinding_TicketService1" />
</client>
receiveTimeout="00:30:00"已经设置为30分钟了。
现在把InactivityTimeout也设置为30分钟就可以了。
通道闲置时间太久 也会出错。