开发者

When & where I should use 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.


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.


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.


WCF is useful when building applications or services that need to communicate with each other.

You can use WCF to easily build programs that communicate, whether it's across processes, across servers, or across the world.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜