Search code examples
c#.netwcfservice.net-5

How can I use Service Communciation in net 5.0?


I used WCF to communciate with my service. I upgraded my project from .net framework to net 5.0. But I found that there's no 'ServiceHost' class. Based on my searching results, net 5.0 doesn't support WCF. Is there a way to communciate with my service?


Solution

  • The original implementation of Windows Communication Foundation (WCF) was only supported on Windows. However, there is a client port available from the .NET Foundation. It is entirely open source, cross platform, and supported by Microsoft. The core NuGet packages are listed below:

    1. System.ServiceModel.Duplex.

    2. System.ServiceModel.Federation.

    3. System.ServiceModel.Http.

    4. System.ServiceModel.NetTcp.

    5. System.ServiceModel.Primitives.

    6. System.ServiceModel.Security.

    The community maintains the server components that complement the aforementioned client libraries. The GitHub repository can be found at CoreWCF. The server components are not officially supported by Microsoft. For an alternative to WCF, consider gRPC.