简体   繁体   English

如何在WCF中的netNamedPipeBinding中禁用可靠的会话?

[英]How to disable reliable session in netNamedPipeBinding in WCF?

如何在命名管道绑定中禁用可靠的会话?

Before opening the host, set the Contract.SessionMode to SessionMode.Allowed when using a named pipe binding 在打开主机之前,将Contract.SessionMode设置为SessionMode.Allowed 。使用命名管道绑定时允许

// create a service host with a custom endpoint based on what we know
ServiceHost host = new ServiceHost(serviceHostType);
NetNamedPipeBinding binding = new NetNamedPipeBinding();

ServiceEndpoint ep = host.AddServiceEndpoint(contractName, binding, endpoint.Uri);
ep.Contract.SessionMode = SessionMode.Allowed;

wcfServices.Add(host);
host.Open();

Named Pipe doesn't support reliable session configuration. 命名管道不支持可靠的会话配置。 You'd need to create a custom binding. 您需要创建一个自定义绑定。

More info at Reliable Sessions Overview 有关“ 可靠的会话概述”的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM