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

发布于 2024-08-30 06:56:59 字数 24 浏览 2 评论 0原文

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

How do I disable reliable sessions in a named pipe binding?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

假装不在乎 2024-09-06 06:56:59

命名管道不支持可靠的会话配置。您需要创建自定义绑定。

有关详细信息,请访问可靠会话概述

Named Pipe doesn't support reliable session configuration. You'd need to create a custom binding.

More info at Reliable Sessions Overview

皇甫轩 2024-09-06 06:56:59

在打开主机之前,如果使用命名管道绑定,请将 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();

Before opening the host, set the Contract.SessionMode to SessionMode.Allowed when using a named pipe binding

// 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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文