Search code examples
c#wcf.net-corecompatibilitysoftware-design

.NET Core service compatibility with legacy WCF clients


I have this ancient cursed legacy spaghetti codebase that I inherithed at my workplace. It's composed of multiple windows services and a couple of GUIs. All projects target .NET Framework 4.something (different projects target different version) so, obviously, they are Windows only.

I tought to rewrite it from scratch in .NET 3.1 (and now that it has been released, 6.0) since i figured out it would be the fastest and better option to avoid going crazy (it was really that bad) and since this is being installed in embedded machines and a per-machine Windows licence is expensive.

Now, since those services target .NET Framework, so Microsoft stuff only, they use Windows Comunication Foundation; or at least I'm pretty sure they do, since one of the public interfaces has this attribute

[ServiceContract(Name="Service",Namespace="http://tempuri.org/")]

(written exactly like that. and despite the tempuri this stuff's in production)

The applications can also be installed on a users' computer (specific admin GUIs), and given that there also are 3rd party consumers for those WCF services, that are installed on users' Windows computers, changing the public WCF API is a no-go.

I re-developed the stack that does (better) exactly what the previus codebase did, but now I'm at a point where i don't know how to recreate the WCF service in .NET 6.0 since WCF is a windows-only, .NETFramework-specific technology.

My take on the problem was to create a new gRPC/REST service and have a secondary translator/adapter .NET Framework service specifically for compatibility since as of now 3rd party consumers have been installed only in Windows machines. (i do have some bare documentation and the .wsdl so i can recreate it no problem. also the spaghetti source code)

But maybe a better solution exists: Is there a way to recreate e WCF-compatible server in .NET Core? Should i stick with the adapter service? Target .NET Standard 2.1 for the business logic and have a .NET Framework service use it? Or is there a better solution I'm not seeing?

Thanks in advance to everyone that will take the time to read and answer.


Solution

  • 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.
    https://visualrecode.com/blog/wcf-alternatives-for-net5/