Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to WCF [closed]

Tags:

wcf

service

I'm currently implementing a Silverlight application using WCF for the communication between client and server. I've heard that using WCF we're bound to use some Microsoft technology at the client side, and can't easily replace this with "anything" - at least with the default SOAP implementation of WPF.

So my questions are:

  • Is this true?
  • What about Restful WCF services? I picture a plain REST implementation, and any client could communicate with this server side through REST. Yes? No?
  • What are the (good) alternatives to throwing out WCF? And why would I want to do that?
like image 319
stiank81 Avatar asked Aug 11 '09 19:08

stiank81


People also ask

Is WCF obsolete?

Just like Web Forms and other . NET Framework technologies, your WCF applications will continue to work for a long time. In fact, WCF will likely work for the next two decades thanks to . NET Framework being considered part of the windows operating system.

Does gRPC replace WCF?

With WCF (Windows Communication Foundation) no longer being actively developed, gRPC (remote procedure call) appears to be the natural replacement when it comes to developing greenfield service applications on . NET Core and .

Is gRPC faster than WCF?

GRPC is better than WCF in terms of performance.


2 Answers

I'm apart of the core team that maintains ServiceStack - a mature Open Source alternative to WCF: modern, code-first, model-driven, WCF replacement web services framework encouraging code and remote best-practices for creating terse, DRY, high-perfomance, scalable REST web services.

It has automatic support JSON, JSONP, CORS headers as well as form-urlencoded/multipart-formdata. The Online Demos are a good start to look at since they all use Ajax.

In addition, there's no XML config, or code-gen and your 'write-once' C# web service provides all JSON, XML, SOAP, JSV, CSV, HTML endpoints enabled out-of-the-box, automatically with hooks to plug in your own Content Types if needed.

It also includes generic sync/async service clients providing a fast, typed, client/server communication gateway end-to-end.

This is the complete example of all the code needed to create a simple web service, that is automatically without any config, registered and made available on all the web data formats on pre-defined and custom REST-ful routes:

public class Hello : IReturn<HelloResponse> 
{
    public string Name { get; set; }
}

public class HelloResponse 
{
    public string Result { get; set; }
}

public class HelloService : Service 
{
    public object Get(Hello request)
    {
        return new HelloResponse { Result = "Hello, " + request.Name };
    }
}

Above service can be called (without any build-steps/code-gen) in C# with the line below:

HelloResponse response = client.Get(new Hello { Name = "World!" });
response.Result.Print(); // => Hello, World

And in jQuery with:

$.getJSON('hello/World!', function(r){ 
    alert(r.Result); 
});
like image 167
mythz Avatar answered Oct 14 '22 07:10

mythz


I've heard that using WCF we're bound to use some Microsoft technology at the client side

Well, then you've been lied to!

Many vendors and open source libraries support SOAP - it's a W3C standard, not a Microsoft-specific idea.

One great alternative for a RESTful service is ASP.NET MVC, which I've found a very easy way to expose methods directly as URLs.

like image 39
Daniel Earwicker Avatar answered Oct 14 '22 07:10

Daniel Earwicker