Application & Data Migration Blog Posts | Mobilize.Net

Consuming WCF Services in .NET 8 (.NET Core is no more!)

Written by DeeDee Walsh | Jan 29, 2024 8:02:00 AM
Back in 2021, Mauricio Rojas wrote a post, "Can I use WCF in .NET Core .NET6" which was obviously very interesting to lots of .NET developers. While the original post accurately described the state of WCF in .NET Core back in 2021, things have changed significantly with the release of .NET 8. Here's an updated look at using WCF services in the latest landscape:

Can you consume WCF services in .NET 8?

Yes! The good news is, consuming WCF services remains fully supported in .NET 8, building on the foundation established in .NET Core. You can reference WCF libraries directly and interact with existing WCF services seamlessly.

But wait, there's more:

The original limitations around WCF service configuration and authentication still apply, although some additional options have emerged:

    • Endpoint Behaviors: While app.config configuration isn't available, several methods exist for programmatic configuration in code. Consider using IServiceBehavior, custom IEndpointBehavior implementations, or builder configurations offered by CoreWCF (discussed later).
    • appsettings.json: While not directly supported for WCF behaviors, you can use it to store configuration data and access it within your custom behavior implementations.
    • Windows Identity Foundation (WIF): WIF still isn't supported, but JWT tokens offer a viable alternative for implementing secure communication. Both client and server code need to be adjusted accordingly.

Moving forward:

While gRPC remains a recommended alternative for new projects, migrating existing WCF services might not be the top priority. CoreWCF, an open-source project, actively maintains and improves WCF for .NET, including features like gRPC interoperability. This ongoing development makes WCF a viable option for the foreseeable future.

Resources:

Remember:

This content focuses on consuming WCF services in NET 8. Hosting WCF services within ASP.NET Core applications remains unsupported in .NET 8.

I hope this updated version provides a clearer picture of using WCF in the context of .NET 8. Please let me know if you have any questions!