WCF or Asp.Net MVC for API acess? - asp.net-mvc-3

I wanted to get some thoughts about API access either through WCF or MVC. Either works, but I like the idea of using MVC to build custom routes. I know this is possible with WCF (maintaining the request routes), but aside form the security disadvantages of not using WCF (which are not deal breakers) what other thoughts does the community have regarding this.
I have a project where we have been discussion using MVC or WCF and we are comfortable with both, but we are swaying towards MVC.

You should use the new ASP.Net MVC Web API framework, new to MVC 4.0.

I think MVC makes a great web API. I did this not too long ago for an android app that uses a RESTful web API using MVC 3. Here's a good tutorial:
http://msdn.microsoft.com/en-us/magazine/dd943053.aspx
If you're feeling adventurous check out the Web API framework included in MVC 4. NOTE: I have not experimented with this yet but plan to in the near future. See here: http://www.asp.net/web-api

Related

Service Layer with WebApi

I am starting to work on a new project so working on laying on the architechture at this moment.
So basically we want to keep a service oriented architecture using MVC web api.
So I had the following structure in mind:
Project.Core (All Poco classes)
Proect.Data (All entity framerwork)
Project.Service (All Web API ??)
Project.Web
We would be working for the first time on webapi here. So wanted to know how do we intergrate webapi here.
Most of the articles we saw read had created a mvc web application and had selected webapi in that. But we
were looking to create separate service layer just for webapi. Is this the correct practice to do that or
I am missing something here.
We basically wanted not to have a tight coupling b.w MVC web and web api here. If we create web api as part
of mvc then how can we separately access our web api.
WOuld appreciate inputs.
I normally use the project template provided by Visual Studio. Choose Empty ASP.NET project template and then select Add folders and references for Web API. It will create the folder structure needed/recommended purely for a Web API project without any MVC reference. I generally create a separate project for Data Access and use that from the Web API project.

How to achieve ASP.NET Core Web API documentation?

with ASP.NET WebAPI 2.0 we could abe to manage documentation of API using HelpPage. Is this feature continuing with ASP.NET Core or has introduced new approach to achieve this?
There is much better alternative called "Swashbuckle.Swagger". It's excellent and being using it for more than year for Web API 2 as well as ASP.NET Core Web API.
For more details Read this article

quickest way to implement .net authentication in Web Forms with Entity Framework 6

I have been checking resources to implement authentication in my web forms application built with entity framework. All examples I found are MVC-related. I have used regular Asp.Net Membership framework a long time before I began to use EF. However, I could not find Membership implementation with Entity Framework code-first. I did implement the Claims-Based Identity (EF created the tables for me in DB) but I do not know how to utilize it in the application (like login), and it looks more complicated to me. Can anyone guide me ?
There are a couple of good tutorials on the asp.net web site:
http://www.asp.net/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project
http://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/membership-and-administration

Webapi with MVP based webform application

We have a web application built using ASP .NET 4.5 Webforms stack and based on MVP Pattern.
We are currently in the process of making certain aspects of the application service-oriented
which can then be used to serve the relevant content to third party clients.
Rather than doing a major overhaul, one of the options we are looking out is exposing this as WebAPI endpoints. Is anyone aware of codeplex/github hosted sample projects demonstrating the use of WebAPI ends points with MVP based webforms application? Any suggestions/insight/ recommendations would be helpful? Thanks.
A sample using Web Forms + Web API can be found here:
http://aspnet.codeplex.com/sourcecontrol/latest#Samples/WebApi/WebFormSample/ReadMe.txt

.NET 4.0 MEF. Pluggable ASP.NET MVC 3.0 Approach

I am going to start new MVC 3.0 .NET 4.0 application.
I want to implement each component for my web site once and simply reuse it then for another web sites i going to build.
Currently i am looking the best practice i can use to achieve my goal.
I did some research and found that I may get a lot of advantages using MEF.
I found interesting MEF MVC solution called plugable MVC http://www.thegecko.org/index.php/2010/06/pluggable-mvc-2-0-using-mef-and-strongly-typed-views.
Is it really worth to use such kind of approach(Plugabble MVC) of building MVC apps?
Advantages disadvantages of pluggable MVC?
May be somebody may suggest something else?
What specific problem are you trying to solve? MVC is a very extensible and pluggable framework as it is. I would say that for a simple site MEF is not necessary. Please provide more information on the issues you are running into with the stock MVC framework.

Resources