Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

C# Rest Web Services API can only be created using asp.net MVC?

Hi, I'm using VS2012.  
I need to create a Rest Web Service program that will consume another web service to get data, re-package it then provide as a web service to another program with this new packaged/formatted data.  
Is the only way to do this in C# is using the MVC model?
I did find a couple of project templates in VS when I click to start new project, "Web Form web API application project template" and "ASP.net MVC Boilerpate".  Which template should I use?
Thank you.
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Actually you can select Web API project from ASP.NET MVC 4 project type dialog, select the as shown here:
http://www.asp.net/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api
Avatar of sudheeshthegreat
sudheeshthegreat

ASP.NET Web API and WCF are the 2 main ways in which you can create ReSTful services with C# now. There are other ways too, but you probably dont want to unless there are reasons these frameworks cannot provide you with what you need.
Avatar of lapucca

ASKER

Which is most used now to create REST API?  ASP.NET MVC API or WCF?
So, web api cannot be created using a regular asp.net project template?  It has to be asp.net MVC project template and then select WEB API?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of sudheeshthegreat
sudheeshthegreat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca

ASKER

Sud, thank you for that break down analysis and the link.  Just one last  question.  Since I'm writing new RESTFUL APIs so I will go with the ASP.NET WEB API , so I have to do this in ASP.NET MVC?  Or can I do this using a ASP.NET web project template?  I mean, when I create a RESTFUL project, what option do I have in Visual Studio 2012 as to what project templates should I use if I'm going with ASP.NET Web API.
Thank you.
The project templates are a bit different depending on which editor / IDE you use.

With Visual Studio 2013, there's a project template for ASP.NET Web Application, which further lets you choose one or more of Web Forms, MVC, Web API, and so on. So, in your case, you just need to create a project using the ASP.NET Web Application template, and select Web API.

ASP.NET MVC is typically used for creating a website, not a web service. Although there isnt anything stopping you from sending back non-html content (such as json or xml) for all the controllers' actions in MVC either.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca

ASKER

I haven't developed in ASP.NET MVS for over 5 years and would rather stick with good old ASP.NET project if I can.  I'm using VS2012 however, I did download the VS2013 but I think that is just the Beta version, can I use VS2013 or should I?  Thank you.
It is actually easier to work with web api over WCF for REST web service and it can be consumed using C# or Jquery AJAX. There is no need to use MVC constructs if you just want to build a Web API project containing the web service
You do not need VS2013 to use Web api as per info in the links.
Better to use VS2013 Community Edition.
Avatar of lapucca

ASKER

thank you both for your great input.