WCF, MVC API, ASMX or Handlers RRS feed

  • Question

  • User-951749790 posted

    I'm currently working on a project (.NET 4) that will accept only XML from external websites.  The XML is will be in the same format each time. Very large amounts of traffic.   I'm just scratching my head at what to use.  I've done WCF and Handlers.   However, I've been reading some articles about MVC API and that seems promising as well.

    So this is sort of a poll, question and maybe a real world example.   Maybe someone to push me in a direction.  :) 

    Friday, February 8, 2013 10:13 AM

All replies

  • User2114377676 posted
    Well, web API might be a good fit, but you should consider it only if you are going web side, i.e. you already have or need web application. WCF will be a good choice when you build SOA-like architecture, i.e. SaaS or enterprise system where applications communicates with web service, which is acting as centralized middleware. You can configure your web service to use streaming or add load-balancing without impact on existing web site as well as host it on dedicated server. Moreover what is your web site or server is down? Then web api is also unavailable, so it is good practice not mixing unrelated things
    Wednesday, June 26, 2013 10:28 AM
  • User-488622176 posted

    First ask your self what you want to achieve (goals). Then try to go one level more in detail : take your goal, and decompose it into subgoals. Match each subgoal with the best architecture desision, keeping these things in mind :

    • A service can be considered as something that translates input messages into output messages. The translation itself is the functionality of the service method. A service typically groupes specific methods serving the same purpose. A pattern often used is to let one service interface represent one use case (where all methods implement the use case). In their purest form services consist of a service interface (ex C# interface) and an implementation class (ex C# class). A service class can implement many interfaces (the service class is also referenced to as the service component)
    • If you want to expose services to the outside world, you need some wrapping technology that allows services to be invoked from outside the assembly (dll) the service is implemented in. The most common wrapper is WCF. (in the past : "webservices/asmx")
    • Native services use SOAP to communicate with (the way data is serialized). An alternative for specific cases is RESTfull services (info on http://msdn.microsoft.com/en-us/library/dd203052.aspx). They are not better or worse then other services, but sometimes they are more usefull. A framework for using restfull services is the Web API framework. See http://www.asp.net/web-api
    • Handlers are not an architectural topic. They are merely a way to tell the webserver how to interprete an URL. Example : the .svc will be mapped to the underlying wcf service call. A handler makes this happen.
    • ASP.NET MVC is an implementation of a presentation layer pattern called MVC or Model-View-Controller. It is a technique to build web applications with advantages and disadvantages. More info can be found on http://www.asp.net/mvc/mvc4

    About asmx : drop it, it is legacy Smile

    Friday, June 28, 2013 7:26 AM
  • User220959680 posted


    ASP.NET Web API  is released with MVC 4 during last year to implement HTTP services based on REST.

    As you already noticed WCF is more configuration than convention, Web API is more convention based rather than configuriaton based. It allows implementation of Web Service that exposes data in either XML or Json format. 

    Having worked with WCF for over couple of years would strongly vote ASP.NET Web API to implement a Web Service.

    when your service is accepting XML and processing, Web API can be chosen to implement the service. 

    Refer http://www.asp.net/web-api for Tutorials, Videos, Books, Samples.

    Below is the diagram from Microsoft's Scott Hanselman - what technology choose from JumpStart event. Refer 04 | Building a Service Layer with ASP.NET Web API

    Monday, July 1, 2013 6:52 AM