Difference in webapi in asp.net and asp.net core - asp.net-mvc

In Visual Studio I have a choice of creating an ASP.NET Core (2) and ASP.NET application. I understand the differences between the core and non-core frameworks, but it seems there is a difference in how ASP.Net MVC/webapi is handled by the two versions, specifically and focusing only on webapi I'm getting the impression:
Core can create 2 types
1. Webapi: a RESTful service, and nothing more
2. Web MVC: MVC web application using razor with webapi available
However, non-core (for want of a better word)
1. webapi: RESTful service but built on (you have to have) MVC
2. mvc: A MVC without ability to use webapi. MVC can use razor or web forms
Can someone let me know why ASP.Net MVC has been separated like this as it's really confusing, and whether future versions (I'm presuming .net core seems the more up to date) will converge in how they work (i.e. full-fat MVC will allow separation of web api).
thanks.

Related

MVC Architecture in .Net6

Basically I want to follow MVC Architecture. So should I use Asp.Net Web Api or Asp.Net MVC for backend development?
Does Asp.Net Web Api have MVC architecture? If does help me build Web Api using MVC Architecture in .net 6.
Based on what you've written, you have a couple options.
MVC is a front-end design pattern. For backend development, you could create a Web API project, which would give you the ability to create models and controllers similar to MVC. You would not create views with Web API as there is no UI.
Alternatively, and especially if it's a smaller project where scalability is not a concern, you could create an MVC project representing the whole app and include the backend code there rather than creating a separate backend project. In this case you'd have models and controllers driving the UI, but not the backend.

Silverlight/RIA Services and ASP .NET MVC/WebAPI

I did some research around but I have some doubts still about following topic...
I have Silverlight/RIA Services project that needs to have ASP.NET MVC look as well as WebAPI for some different clients.
So my question is following
Can we use somehow RIA Services with ASP.NET MVC 5?
And if not what is a painless way to represent all existing logic in ASP.NET MVC?
Thank you!
Ria services have nothing to do with look and feel.
A Silverlight app or a non plugin, which uses RIA services can be hosted in a web page created using ASP.Net.
Can we use somehow RIA Services with ASP.NET MVC 5?
Yes.
RIA services which could be used by an asp.net backend would not gain the benefit of RIA services because changes made in the backend end are not generated forward to an application such as a Silverlight plugin. It just becomes another way of accessing data.

RESTful services: WCF versus ASP.NET MVC

A very common approach to implementing RESTful services is by utilizing ASP.NET MVC to do so over WCF.
ASP.NET MVC has excellent RESTful support by via flexible URL routing and flexible HTTP Method mapping to controller actions.
WCF 4.0 now has excellent support for implementing RESTful service also using the same ASP.NET routing mechanism as ASP.NET MVC.
Question
What are your experiences working with either of the 2 approaches to create RESTful services and pros and cons encountered?
WCF services can be self-hosted. No IIS required. ASP.NET MVC is focused on delivering HTML, whereas the existing .net 4 WCF stack is focused more on XML and JSON.
The new http://wcf.codeplex.com is the next generation of REST on WCF and will be significantly more capable than the existing stack.
The new stack will be much better at supporting all different media types. It provides much better access to the underlying HTTP protocol. It will be much more testable and will make it easier to plug in reusable handlers to add standard behaviours.
Take a look at Podcast from Scott Hanselminutes with Glenn Block where they discuss same issue and compares MVC and new WCF Web API.
http://www.hanselminutes.com/default.aspx?showID=284
I'd say WCF is better suited to build services, you can do it with asp.net mvc but it requires more ceremony

Best practices for Silverlight usage in a ASP.NET MVC application

What are the best practices for ASP.NET MVC and Silverlight usage in a web application? To be specific which libraries/frameworks (like prism) should be used in order to make the application unit testable and develop rapid? How one should pass data to the silverlight part from asp.net mvc (binding if possible?) and vice verse (from asp.net to silverlight)?
The Entity Framework with RIA services is made precisely for this purpose.
I propose:
asp.net mvc as service layer
silverlight as client
linq2sql for datalayer
nunit for testing

Which's the best performance between Asp.net MVC controller VS. Wcf for Silverlight Application?

I found that Asp.net Mvc controller can serve both Asp.net Mvc View and Silverlight application via DynamicActionResult(It can be Simple Action Result or Json Action Result depend on request type). So, I have 3 options for creating middle-tier for Silverlight application.
Pure WCF Service Every request to WCF must be declare in interface. So, it's strongly-typed connection.
Asp.net MVC Controller It can serve both Asp.net MVC View and Silverlight application at the same time.
Using both of them I found that it's possible to doing this by using the answer in the following link. I think, It doesn't good idea for creating both of them.
WCF Service with Asp.net MVC application
Which's the best performance between WCF Service and Asp.net MVC Controller?
Thanks,
Do you have the kind of service that would benefit from caching? If so, my testing says that MVC with Output Caching turned on is very much faster than WCF.

Resources