WCF came with .Net framework 4.0 for building services that have WSDL interface and advanced WS standards such as WD-Addressing, WS-ReliableMessaging and WS-Security. Now when we are modernizing our applications then these applications are need to be upgraded. Lets see alternatives.
- Latest version: 1.0
- It provides a compatible implementation of SOAP, NetTCP, and WSDL.
- Its now a community project
- Use it to modernize your application when you don’t want complete re-write.
- Avoid using it for green field projects.
- Provides WCF functionality for
.NET Core 3.1
.NET Standard 2.0
.NET Framework 4.6.2+
.NET 5+.
- Microsoft recommend gRPC for the replacement of WCF services.
- Provide the RPC features.
- Good performance and interoperability. Fast to serialize and deserialize.
- Its secure. gRPC can use TLS and HTTP/2 to provide an end-to-end encrypted connection.
- WCF and gRPC both are RPC with similar goals.
- Where efficiency is critical or real time communication is required. Has lightweight message format(Protobuf) than an equivalent JSON message.
- Easy to build HTTP services and works with HTTP verbs ( GET, PUT, POST, and DELETE).
- For RESTful applications.
- If you have an existing WCF service with REST endpoints, migrate that to Web API.
- Its Stateless. Unlike a WCF REST service, it use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
- It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api