.NET Zone is brought to you in partnership with:

Daniel Mohl is a professional software engineer/architect whose interests include understanding the intricacies of various programming languages, enterprise application architecture, and how to bridge the gap between business and technology. He works with F#, C#, CoffeeScript, JavaScript, Erlang, ASP.NET MVC, WPF, WCF, Silverlight, WP7, SQL Server, etc. He is a F# MVP, C# Insider, F# Insider, blogger, speaker, and event organizer. You can follow him on twitter at www.twitter.com/dmohl. Daniel is a DZone MVB and is not an employee of DZone and has posted 30 posts at DZone. You can read more from them at their website. View Full User Profile

F# and ASP.NET Web API

03.05.2012
| 5514 views |
  • submit to reddit
A few weeks ago the ASP.NET team announced the release of ASP.NET MVC 4 Beta. You can read about it here. One of the exciting features that was announced is ASP.NET Web API. ASP.NET Web API provides an excellent programming model for building HTTP services.

One of the sweet spots for F# is in the services layer and this makes ASP.NET Web API + F# great friends. To make it easy to get started with F# and ASP.NET Web API, I've added an ASP.NET Web API template to the already existing F#/C# ASP.NET MVC 4 Visual Studio extension. Note: The template requires that ASP.NET MVC 4 Beta is installed.

To install the template, do the following:

1. Launch the project creation wizard (Ctrl+Shift+N), select Online in the left hand nav, search for "fsharp mvc4", and click OK. In VS11 Beta, it looks something like the following. Note: It may take a few seconds to download.


2. After clicking OK and installing the extension, you will see a dialog that allows the creation of a new ASP.NET Web API solution with an F# project that contains the server-side code.


3. Once the project has been created, you can run it however you desire and hit the service via http://localhost:###/api/values.
References
Published at DZone with permission of Daniel Mohl, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Imdadyano Yano replied on Tue, 2012/03/06 - 9:00am

Hello, I went through your article. It looks interesting, but I am a beginner in F#. can you suggest how to start on this. Are you integrating MVC4 along with F#?. Any help on this will be appreciated. Thanks once again.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.