在 .Net 5 中添加对 netNamedPipeBinding 的引用

问题描述

我在 .net 框架 4.6.1 中有类库项目。我必须将该项目迁移到 .net 5。 这样做时,我遇到了 netNamedPipeBinding 的错误

Severity    Code    Description Project File    Line    Suppression State
Error   CS0246  The type or namespace name 'NetNamedPipeBinding' Could not be found (are you missing a using directive or an assembly reference?)    

以下 nuget 包已经安装。

System.ServiceModel.Duplex
System.ServiceModel.Http
System.ServiceModel.NetTcp
System.ServiceModel.Primitives

有什么办法让它工作吗?

解决方法

貌似不支持。

命名管道
WCF 为同一物理机器上的进程之间的通信提供了命名管道绑定。第一次发布 ASP.NET Core gRPC 不支持命名管道。添加客户端和 服务器对命名管道(和 Unix 域套接字)的支持是 未来版本。

https://docs.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/wcf-bindings#named-pipes

此外,NamedPipeBinding 的文档页面已解析为 .NET 4.8 部分,并且 .NET 5
不存在 https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.netnamedpipebinding

HttpBinding 文档页面适用于 .NET 5
https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.nethttpbinding