WCF services on .NET 10: CoreWCF, gRPC or REST?
WCF is the most common blocker when leaving .NET Framework. Three ways forward, what changes for the clients, and an order that keeps everything running.
Vlado Pandžić · Founder · Senior .NET architect
Published · 4 min read
Contents
In almost every migration from .NET Framework, one item stops the plan: the WCF services. The application itself would move, but WCF is not part of modern .NET, and other systems, sometimes ones you do not control, depend on those services every day.
The good news: there are three proven ways forward, and you do not have to choose one for everything at once.
What is a problem, and what is not
- Calling WCF services from .NET 10 is not a problem. Microsoft maintains WCF client libraries for modern .NET, and
dotnet-svcutilgenerates the client code from the service description, as before. - Hosting WCF services is the problem. The WCF server side was never ported to .NET Core and its successors. Every service your application exposes needs a new home.
Three ways forward
| CoreWCF | gRPC | REST API | |
|---|---|---|---|
| What it is | A port of WCF to modern .NET | A fast, contract-first protocol over HTTP/2 | ASP.NET Core Web API with JSON |
| What changes for the clients | Usually nothing | New client code | New client code |
| Your existing code | Contracts and implementation largely stay | The service layer is rewritten | The service layer is rewritten |
| Fits best | Moving to .NET 10 without touching the consumers | Service-to-service calls inside your own systems | Consumers you do not control, browsers, other platforms |
| Watch | Not every WCF feature is supported | Browsers need gRPC-Web | More work for the same contract |
CoreWCF is an open-source project that Microsoft supports. Its support follows the .NET version it runs on; version 1.9 supports .NET 10.
CoreWCF: the same contract on .NET 10
With CoreWCF, the service contract stays as it is, and the service runs inside an ordinary ASP.NET Core application:
[ServiceContract]
public interface IOrderService
{
[OperationContract]
Task<OrderDto> GetOrderAsync(int id);
}
builder.Services.AddServiceModelServices();
var app = builder.Build();
app.UseServiceModel(services =>
{
services.AddService<OrderService>();
services.AddServiceEndpoint<OrderService, IOrderService>(
new BasicHttpBinding(), "/OrderService.svc");
});
The clients keep calling the same address with the same messages. For the systems that depend on you, nothing changes, and that is often what makes the whole migration possible.
What to check before you choose
- Bindings. The common HTTP and TCP bindings are covered. Less common ones need checking in the CoreWCF documentation before you commit.
- Security. Windows authentication, message security and certificates often take more time than the code itself.
- Duplex and callbacks. Services that call the client back are harder to move, whichever path you take.
- Who the consumers are. Your own applications can change together with the service. A partner’s system or a device in the field usually cannot, and for those, CoreWCF is often the only realistic first step.
The order that works
- Step 1Inventory: services, bindings, consumers
- Step 2CoreWCF on .NET 10, clients unchanged
- Step 3New gRPC or REST endpoints beside it
- Step 4Move consumers one by one, then switch off
The first move gets the application onto a supported .NET without asking anyone else to change. After that, new endpoints can run next to the old ones, and each consumer moves when it suits them. The WCF endpoint is switched off only when nobody calls it anymore, which the logs will tell you.
How long it takes
Rough ranges:
- a few services on basic HTTP bindings, consumed by your own applications: a few days to CoreWCF
- many services with Windows authentication, certificates and external consumers: several weeks
- a full move to gRPC or REST: depends on the number of consumers, more than on the services themselves
WCF is usually one part of a larger move. The whole picture is in our article on migrating from .NET Framework to .NET 10, and the data layer in EF6 to EF Core.
How we work
This is exactly what we do. ProCoding is a .NET studio in Split, Croatia, and we move older .NET applications to modern .NET one piece at a time, keeping them running while we do: services, data layer and screens. We start with the inventory and propose the order. On your own, with your team, or with a freelance .NET developer inside your team. The first step is a free 30-minute call.
Sources
- CoreWCF support policy, Microsoft
- CoreWCF, GitHub
- WCF client libraries for .NET, GitHub
- WCF dotnet-svcutil tool, Microsoft Learn
- gRPC on .NET, Microsoft Learn
This article is general information only, not legal, tax, financial or other professional advice. Scenarios, examples and calculations are illustrative. Terms of use and disclaimer.