如何在 net 5.0 中使用服务通信?

How can I use Service Communciation in net 5.0?

我使用 WCF 与我的服务进行通信。我将我的项目从 .net 框架升级到 net 5.0。但是我发现没有'ServiceHost'class。根据我的搜索结果,net 5.0 不支持 WCF。有没有办法与我的服务进行通信?

Windows Communication Foundation (WCF) 的原始实现仅在 Windows 上受支持。但是,.NET Foundation 提供了一个客户端端口。它是完全开源的、跨平台的,并得到微软的支持。下面列出了核心 NuGet 包:

  1. System.ServiceModel.Duplex.

  2. System.ServiceModel.Federation.

  3. System.ServiceModel.Http.

  4. System.ServiceModel.NetTcp.

  5. System.ServiceModel.Primitives.

  6. System.ServiceModel.Security.

社区维护补充上述客户端库的服务器组件。 GitHub 存储库位于 CoreWCF. The server components are not officially supported by Microsoft. For an alternative to WCF, consider gRPC