开发者

When should I use wcf in my asp.net project?

For example I need 开发者_StackOverflowto create middle size internet shop with public frontend and private backend. No silverlight, only html

Is there any sense to use wcf?

If yes, what benefits I will get with wcf?


No. WCF is designed to expose web services or other services for communicating between servers.


If you have only your ASP.NET shop, and just two servers (web and database) close together, and no intention of ever moving to a Silverlight client, or offer some data (e.g. order status information) to your customers in some other way than through your web site - then no, WCF won't be a benefit to you in this case.

HOWEVER:

  • should you ever even consider having a Silverlight client

or:

  • should you ever want to expose certain bits of information to the outside world in a fashion independent of your web site (like through a web service, an Atom feed - something)

then you would benefit from thinking about how to make good use of WCF services, and you might even see that in the end, it's really not much effort to switch to using WCF - even for a stand-alone ASP.NET application.

When you go Silverlight, you basically have no choice but to use WCF services. And while a lot of programmers bemoan this - I believe it's actually a good thing (tm)

Being forced to think in a service oriented way, being aware of network latency, of the network traffic unnecessary queries produce, will ultimately lead to a better architecture - one that is more performant, more maintainable, more scalar.

So yes - you can keep sticking to just accessing your data directly from ASP.NET - nothing wrong with that. Or you can invest into the future, get to know service-oriented programming and its challenges and benefits now and start using WCF services - even in your own "simple" ASP.NET apps.

Encapsulating some of your processing (and possibly data access) logic into WCF services gives you another way of breaking up your code into separate, largely independent blocks that can be easier to create and maintain. It can also open up new possibilities you never have if you're doing everything inside your ASP.NET app. But it does require a bit more effort - the classic tradeoff.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜