Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When & where I should use WCF

Tags:

wcf

I have went through several online tutorials that cover the advantage of WCF, how to build the service/client, etc.

However, I want to know a little whole picture.

Question> What kind of application or which features in the app require me to use WCF functionality? A concrete example should help me better.

like image 216
q0987 Avatar asked Jul 07 '11 18:07

q0987


2 Answers

There are several situations that would "require" WCF. First it should be noted that "require" is a strong word, while WCF is the current preferred model for communications in .NET, the platform has a history of other methods which are all still supported.

Concrete Example 1: Your web app is performing poorly because some of the computational work to prepare a response is "computationally expensive" and is eating up CPU. You want to move the expense portion to a service that runs on another box where you can give it isolated resources. You create a WCF service which wraps the functionality and deploy that service to another box, using a proxy class to access it across the network.

Concrete Example 2: Your windows application needs to access resources which are behind a firewall that your users cannot penetrate. So you instead choose to deploy a service in a DMZ which the application can use, and which from the DMZ accesses the restricted material and returns the results to your application.

WCF is a powerful tool, and does incredible things to help service development especially when you are developing SOAP based services. On the other hand, there are many who feel that currently the easier way to write RESTful services is to do so with ASP.NET MVC's WebAPI. WebAPI started as a project of the WCF Team, but was eventually moved into MVC for a variety of reasons. If you're interested in REST, I would recommend looking at WebAPI.

like image 197
TRayburn Avatar answered Sep 19 '22 15:09

TRayburn


Think of WCF as a way to project your application's services (functionality) across boundaries that have traditionally been very difficult to cross. HTTP(S) is one way to enable this. Factor in REST principles, and you get to some pretty elegant solutions that are very inter operable. WCF-based services also give you more flexibility in how you can deploy your solution in different environments. It affects non-functional elements like security and scale up vs. scale out discussions, too.

like image 34
joebalt Avatar answered Sep 17 '22 15:09

joebalt