WCF Alternatives for .NET 5

Update Mar 31st 2022

Since the release of this article, .NET 6 has come out. We recommend most migrations target .NET 6., as .NET 5 enters the end of its support on May 8th 2022. You can read more on migrating WCF applications to .NET 6 here.

The alternatives listed here are the ones we would recommend for .NET 6 migrations as well. So, feel free to use this article as an introduction to WCF alternatives, just know that it is much wiser to target .NET 6 at this time.

The .NET 5 era has begun

It’s official; you can start targeting .NET 5 as your platform of choice. It’s the first option for download on Microsoft’s website, it’s the first framework listed in Visual Studio, and Scott Hanselman even updated his personal sites to .NET 5 live for .NET Conf 2020.

This new version of .NET unifies .NET Core and .NET Framework, bringing the significant improvements made in .NET Core to a wider audience of developers that couldn’t upgrade before. Unfortunately, not all of the .NET Framework technologies got ported over - including WCF.

If you want to use .NET 5 or any future versions of .NET, you will need to find an alternative to WCF. The good news is that WCF has some powerful replacements that would be worth using even if you were not forced to move on.

This article will discuss three WCF alternatives to target: gRPC, CoreWCF, and ASP.NET Core MVC.

What does .NET 5 Offer vs. .NET Framework?

All three of the WCF alternatives discussed here not only have their own benefits but provide the benefits of .NET 5 itself. When compared to .NET Framework, those include:

  • Improved performance. Microsoft worked hard to improve the performance of .NET 5, and it shows. No matter which option you go with, it will perform better than .NET Framework with WCF. But performance between the three options will still vary, with some providing more of a boost than others.
  • Cross-platform support. If you want to develop or host your application on a platform other than Windows, you should make the transition to .NET 5. Considering that .NET Framework is considered part of the Windows Operating System, it is tied to the platform and will almost certainly stay tied to the platform for the rest of its life.
  • Built for modern development practices. .NET 5 was built with concepts like Microservices and Containerization in mind. If you are interested in utilizing these kinds of technologies, .NET 5 is the way to go.

These points alone might be enough of a reason for some developers to consider migrating to .NET 5. Some may still be wary and want to wait for a Long Term Support release like .NET 6 or even .NET 8. But to consider any of these options, you will need a replacement for WCF. So whether you plan to migrate now or later, it is worth looking at what you will target and start the planning in advance.

  gRPC CoreWCF ASP.NET Core MVC
Open Source Yes Yes Yes
Development Teams Microsoft and Google .NET Foundation Microsoft
Production-Ready Yes It Depends Yes
Best Use Cases When performance is king, need flexible framework When you can wait, want exact WCF experience Browser applications, when Public APIs are important


Targeting gRPC

You may recognize gRPC as a “universal Remote Procedure Call Framework” already compatible with many different technologies, including .NET since .NET Core 3.0. It is also one of the Microsoft recommended replacements for WCF developers wanting to move to .NET 5.

Pros:

  • It has better performance. WCF has two primary bindings, the basic HTTP binding or the NetTCP binding. We performed tests for both bindings, and gRPC performs significantly better than the HTTP binding and slightly better than the NetTCP binding. No matter which binding your application uses, you will get a performance boost from migrating to gRPC.

  • It is less expensive. But aren’t both options free? Yes. They’re free to use. But your applications are not free to host. Windows is a great operating system, and IIS is a great database, but these are also not the cheapest options. For companies looking at moving operations to the cloud, it will likely be less expensive to use Linux based hosting, which you can do with .NET 5 and gRPC. Even if they used the same stack though, gRPC’s improved performance would further reduce costs. The improved performance means you can get the same number of requests per second using less expensive hardware.

  • It has massive backing. Both Google and Microsoft are stakeholders in gRPC. Google started its development, and Microsoft has heavily invested in making gRPC “a first-class member of the .NET ecosystem.” Also, gRPC is an open-source framework with community contributions. If nothing else, that shows there is some community investment as well.

Cons:

  • No Windows Authentication Support. gRPC requires HTTP/2. While it is a large part of why the framework has such good performance, it also means that it won’t work with Windows Authentication, as it requires HTTP/1.1. As long as Windows Authentication remains an HTTP/1.1 technology, it will not be compatible with anything that requires HTTP/2, or HTTP/3. This may be a highly specific complaint, but many WCF developers use Windows Authentication. Moving to gRPC in those cases would require replacing the authentication system first.

  • Difficulty interacting with the browser. If your application is only interacting with the browser, gRPC may not be a good choice. It is still possible to interact with the browser using gRPC Web, which is worth considering if you have an application that interacts with the browser and other components. For .NET 5, gRPC Web is a built-in option. But if your application is primarily browser-based, there are easier choices.

Targeting CoreWCF

On its surface, CoreWCF looks like the natural next step for WCF developers. But it has some caveats that make it less than an easy choice, especially for people wanting a WCF alternative they can use sooner rather than later.

Pros:

  • It has backing. CoreWCF is an open-source project ran by the .NET Foundation. The Project is based on a code donation given by Microsoft. It doesn’t quite have the same pedigree as being actively developed by both Microsoft and Google, but there has been some real interest shown for the project. CoreWCF has active community involvement and has been updated regularly since its creation.

  • It is still WCF. CoreWCF is a.NET 5 technology that aims to remain compatible with other WCF programs. .NET 5 applications that need to interact with .NET Framework applications can use this as an option that will feel native to both.

Cons:

  • It is not ready for all production applications. According to the .NET Framework team, this project requires community time and testing to get it into shape. As of 2022, it is in a better spot, even used in some production settings by contributors. But there are some missing features that will make it more difficult to use directly for production in certain situations.

  • It is not intended to be a complete port. The idea for CoreWCF is that it will focus on the most used pieces of WCF. This is a smart approach, as it means they will spend the most effort on functions that benefit the most users. But if you are using parts of WCF outside the scope of this project, you may need to find another solution anyway.

  • It is still WCF. There’s a reason Microsoft is not interested in bringing WCF into .NET 5. At this point, there are just better solutions to the problems it set out to solve. CoreWCF is convenient because it may allow you to make the least amount of changes to your application to use .NET 5, but is it the best choice?

Targeting ASP.NET Core MVC

ASP.NET Core MVC is a Microsoft backed alternative and a good option for those who have browser-based applications or want to use REST over RPC.

Pros:

  • Easy Browser Interaction. If you are writing a browser-based application and do not need to communicate with any other platforms or APIs, ASP.NET Core MVC is a strong option. It is designed for web applications specifically, unlike WCF or gRPC.

  • It has massive backing. This is an actively developed component of the .NET 5 + branch. It has full support from Microsoft and a large community of users.

  • A good choice if you have a public API. If you rely on a public API, you may want to use ASP.NET Core MVC with REST instead of gRPC. REST uses JSON, which is a popular, human-readable way to format data. It will be easier for everyone to work with.

  • It is less expensive. Like gRPC, ASP.NET Core MVC benefits from the performance improvements in .NET 5 and can do the same number of interactions as WCF with fewer resources.

Cons:

  • You miss out on some of the performance benefits of gRPC. gRPC performance is generally better than ASP.NET Core MVC. JSON, while easier to work with, is not as efficient as the binary serialization of gRPC. This causes a performance gap that cannot be realistically crossed.

  • Not built for long-lived connections. gRPC has streaming modes that allow for a connection to stay open for a long time. This is good for things like messages, notifications, or sending large datasets over a connection one element at a time. ASP.NET MVC can’t do this.

Which should I choose?

It depends on your time frame and the goals you have for migrating to .NET 5.

  • If you are looking for a flexible framework, target gRPC gRPC is already used in many cross-platform applications and across multiple frameworks as well. gRPC will offer you the most flexibility.

  • If your application interacts primarily with the browser, target ASP.NET Core MVC. It has some downsides compared to gRPC, but it is much easier to work with for web applications.

  • If you absolutely cannot move on from WCF, watch CoreWCF. .NET Framework is not going anywhere any time soon, and WCF will continue to function. If it is crucial to have this sooner rather than later, you can consider becoming a contributor to the project itself.

What does each WCF alternative require for implementation?

What is required for CoreWCF is pretty straight forward. The goal of CoreWCF is only to require a change in Namespace for ported services.

Both gRPC and ASP.NET Core MVC will require a rewrite. The complexity of the rewrite will vary from project to project. If you have services with only a few WCF methods, your rewrite will be much easier than if you are all in on WCF and have hundreds or thousands of methods. In general, it is a lot of typing, many staff hours, and many opportunities to make mistakes.

But Visual Recode lets you automate the rewrite process - reducing the amount of typing, staff hours, and opportunities for mistakes significantly. The idea is to take the stress out of rewriting WCF applications. This way, developers have the option to use modern frameworks like .NET 5 with modern solutions like gRPC and ASP.NET Core MVC instead of navigating the woes of using a legacy technology like WCF. Learn more about our tools for each specific path:

The Hassle-Free Code Upgrade Tool for .NET

Early-bird licenses are just $195 or license your team from $295 per seat.