WCF or ASP.NET MVC

For .NET developers the current framework for developing RESTful applications (without resorting to custom HttpHandler’s and what not) is Windows Communication Foundation (WCF). REST-support is a feature that was added on late in the game and partially due to much pressure from the developer community. However WCF is one of those frameworks that is “all things to all men”. It’s the framework that allows any type of distributed communication (SOAP, MSMQ, binary over TCP/IP) making it (IMO) pretty bloated. Because REST was afterthought, resources are exposed using interfaces and ServiceContracts which doesn’t always seem very natural. Additionally, there isn’t inherent support for HTML (or at least I’m not aware of it) and even if your services don’t serve HTML representations, it should still be a format that could easily served (without concatenating strings).

Interestingly, Microsoft has revealed and released bits that they are working on an alternative to ASP.NET namely ASP.NET MVC. While this newer framework trumps up the fact that it allows developers to develop web applications using the MVC design pattern, what I find more intriguing is that as a framework, it allows development of services in a RESTful manner using a web framework (which WCF is not) that can serve all web formats. There are a lot of posts that talk about how ASP.NET MVC can be used RESTfully.

So the question I have is this: Why would anyone use WCF for RESTful web services once ASP.NET MVC is publicly available?

Advertisements

About Ebenezer

culture hack. contrarian. change artiste. speaker. writer. silo-connector. entrepreneur. totally human. ff at your own risk. :-)
This entry was posted in Design and Architecture and tagged , , , , . Bookmark the permalink.

2 Responses to WCF or ASP.NET MVC

  1. Zygimantas says:

    WCF has the advantage that you can output the same service to multiple channels (JSON, REST, WS, TCP) with no code changes.

    Like

  2. Eb says:

    Zygimantas –

    I think you are possibly mixing up a couple of things and possibly calling them “channels” e.g. REST and WS are not channels. However, I do believe I understand your point which is the possible exposure of the same service over HTTP, TCP, MSMQ etc.

    If your architectural style is REST, then it potentially influences your technology choice and in my opinion ASP.NET MVC may be the better choice. If the architectural style is RPC, then WCF may be a better solution.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s