你已经毫无疑问地解决了这个 - 但对于其他人遇到它(像我一样)......
根据“规划WCF服务”,由朱瓦尔·洛 - 你不能使用已配置SessionMode.Required的合同使用流式传输。请参阅第243页
既不可以使用NetTcpBinding,也不需要可靠的流式传输。
它没有详细说明原因。
一个解决办法可能是分裂需要会话模式划分成独立的合同和流式操作到另一个操作。 然后实现其在非流接口作为RegisterSession(GUID mySessionId)操作通过用于每个客户端的唯一ID(客户端应用程序的生命周期独特GUID)。 当在服务器上创建会话时 - 他们可以使用会话管理器对象进行注册,该对象将GUID,SessionContractImplemenation对存储在Dictionary中。
然后设置了一个param添加到流承包经营(相同GUID),这样流合同执行可以(通过创建会话管理器 - 使用提供的GUID)访问Live非流对象。
当然,您必须适当地管理会话生存期。
从微软...
Sessions and Streaming When you have a large amount of data to transfer, the streaming transfer mode in WCF is a feasible alternative to the default behavior of buffering and processing messages in memory in their entirety. You may get unexpected behavior when streaming calls with a session-based binding. All streaming calls are made through a single channel (the datagram channel) that does not support sessions even if the binding being used is configured to use sessions. If multiple clients make streaming calls to the same service object over a session-based binding, and the service object's concurrency mode is set to single and its instance context mode is set to PerSession, all calls must go through the datagram channel and so only one call is processed at a time. One or more clients may then time out. You can work around this issue by either setting the service object's InstanceContextMode to PerCall or Concurrency to multiple.
注:
MaxConcurrentSessions在这种情况下没有影响,只有一个 “会话” 可用,因为。
请参阅http://msdn.microsoft.com/en-us/library/ms733040.aspx