none
Not getting why not to use WCF

    Question

  • Hi,

    Currently we are planning to build a website.

    As per my experience and knowledge that possess, an ideal solution will be 3 tier architecture.

    UI <--> BAL <--> DAL

    Where UI shall interact with WCF. WCF with Business logic and BAL with DAL.

    But in the brain storming session, my seniors have suggested not to use WCF. Instead of WCF they are emphasizing on using a controller class(As we have in MVC).

    But I am not getting why not to use WCF.

    However, as per the requirement, we are not required to expose services. In case we are required then we can plug in the WCF by removing the controller class.

    On the other hand.. what I believe is.. we should work on WCF instead of controller class and if required to expose services we don have to rework.

    Pls suggest, whether I am on right track of thinking?

    TIA.


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    Tuesday, March 13, 2012 12:28 PM

Answers

  • Hello, if all you need is a 3 tire architecture, there's indeed no need for WCF. WCF is usually used in SOA, not N-tire architecture. Architecture is a very large topic. You can begin from http://en.wikipedia.org/wiki/Service-oriented_architecture to learn SOA.

    By the way, actually MVC controller can be used to implement a REST service, just like WCF can be used to implement a SOAP service. In the past, you also use WCF to build REST services, but the decition has been made to unify WCF and ASP.NET (after all, we only need one .NET platform), so future REST services will be implemented using ASP.NET MVC. Refer to http://www.asp.net/web-api for more information. Again, you need to first decide your architecture. If you simply need a 3 tire architecture, then you don't need to care much about REST stuff. In the future, if you need to adopt SOA, you can modify the MVC controller to make it a real service instead of just a controller.


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email.

    • Proposed as answer by Horizon_NetMVP Wednesday, March 14, 2012 2:13 AM
    • Marked as answer by Tiya01 Thursday, March 15, 2012 6:40 AM
    Wednesday, March 14, 2012 1:43 AM

All replies

  • I'd say, using a controller at the UI layer is fine since MVC is being used. The controller will call the WCF services in the backend and populate the model objects. What you need to do is to wrap the BAL in WCF with service operations that satisfy a business purpose. Using WCF can give a lot of flexibility in the long term, but it can be debated whether to use it if it is not in the requirements. Though the WCF services can be called from any application, rather than just this one.
    Tuesday, March 13, 2012 1:35 PM
  • Hello, if all you need is a 3 tire architecture, there's indeed no need for WCF. WCF is usually used in SOA, not N-tire architecture. Architecture is a very large topic. You can begin from http://en.wikipedia.org/wiki/Service-oriented_architecture to learn SOA.

    By the way, actually MVC controller can be used to implement a REST service, just like WCF can be used to implement a SOAP service. In the past, you also use WCF to build REST services, but the decition has been made to unify WCF and ASP.NET (after all, we only need one .NET platform), so future REST services will be implemented using ASP.NET MVC. Refer to http://www.asp.net/web-api for more information. Again, you need to first decide your architecture. If you simply need a 3 tire architecture, then you don't need to care much about REST stuff. In the future, if you need to adopt SOA, you can modify the MVC controller to make it a real service instead of just a controller.


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email.

    • Proposed as answer by Horizon_NetMVP Wednesday, March 14, 2012 2:13 AM
    • Marked as answer by Tiya01 Thursday, March 15, 2012 6:40 AM
    Wednesday, March 14, 2012 1:43 AM
  • Hi Saurabh,

    Its not entirely MVC architecture.

    We do have models,controller but no views.

    Thanks


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    Wednesday, March 14, 2012 5:15 AM
  • By the way, actually MVC controller can be used to implement a REST service, just like WCF can be used to implement a SOAP service.

    Hi Yi-Lun,

    Can you pls elaborate on the above statement. I tried going through the provided links but I am not pretty much clear with SOAP and REST Services.

    Thanks.


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    Wednesday, March 14, 2012 5:21 AM
  • If you go through http://www.asp.net/web-api, you'll find how to build RESTful services, which is one kind of web service. When using ASP.NET Web API, the REST service is exactly built with an MVC controller.

    These blog posts may also help:

    http://blogs.msdn.com/b/codefx/archive/2012/02/16/a-post-about-restful-services.aspx

    http://blogs.msdn.com/b/codefx/archive/2012/02/23/more-about-rest-file-upload-download-service-with-asp-net-web-api-and-windows-phone-background-file-transfer.aspx.


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email.

    Wednesday, March 14, 2012 8:11 AM