Restful service with .net - asp.net

Microsoft is encouraging developers to use asp.net web api for creating Restful services. I have done some googling
http://www.matlus.com/asp-net-web-api-with-webforms/
it seems to me that i can use it with .net 4.5 but not with 4.0. In .net 4.0 what are my options for creating Restful service. is it only wcf web api or something else that should be used?

You can create asp.net web api service without installing .net 4.5, you only need to install asp.net mvc 4 for VS2010 and normally use for .net 4.0. Alternative, you can use WCF service or asp.net mvc controllers for REST architecture, see this example with asp.net mvc

A small mistake of yours, there is no WCF Web Api anymore. That was the original name, then it was renamed ASP.NET Web Api.
You can use it with .NET 4.0. Just install ASP.NET MVC 4 and you get Web Api. But it's still in Beta...

Related

Web API targeting .Net Framework vs .Net Core

Is message pipe line and other constructs same for Web API that targets .Net Core or .Net framework? Can we use ActionFilters, DelagatingHandlers and other concepts while developing .Net Core based Web API?
For .NET Core, you want use the ASP.NET Core MVC project template. Note, .NET Core MVC and Web API were merged together.
You can read more about the Middleware here:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-2.1

which version of mvc is using in asp.net core 2.0? is is MVC 6 or use different name?

which version of mvc is using in asp.net core 2.0? is is MVC 6 or use different name ?
What is .net 5?
what is .net standard ?
these questions are from an interview.plz help
The .NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET implementations.https://learn.microsoft.com/en-us/dotnet/standard/net-standard .ASP.NET5.0 Is Called ASP.NET Core 1.0 and In the ASP.NET Core 1.0 release, Web API is merged with ASP.NET MVC, termed as MVC 6
They're totally unrelated. "MVC 6" was sort of like a codename for Core when it was still in early stages. ASP.NET MVC and ASP.NET Web Api are totally separate from ASP.NET Core. Now, it's just "Core". There is no "MVC" or "Web Api", because Core controllers do both functions. ASP.NET MVC and ASP.NET Web Api live on and although they will probably eventually be deprecated, they could presumably (though not likely at all) get new releases. At the very least, they'll be patched for the foreseeable future.
ASP.NET Core is a complete rewrite from the ground up. It was originally created simply to be a cross-platform alternative to ASP.NET, and I think the original plan was to keep both ASP.NET and ASP.NET Core as potential development options. However, as ASP.NET Core became more competent, it has pretty fully eclipsed ASP.NET; we now have a cross-platform framework that can run on Windows, Mac and Linux and can do virtually anything the Windows-only framework can. Therefore, why keep the Windows-only framework?
Asp.net Core 2.0 is MVC 6 and The framework is 4.6.1
To start with development you need to have VS-2017 and for 1.X you can start with VS-2015.
Please refer the below link for clear presentation of .NetCore 2.0 so that you can get good knowledge to kick start your development.
Official Asp.Net Core Documentation Url

ASP.NET without Web Api package

I build a web api service for mobile and web, it works fine on azure, but soon I realised that Nuget Manager has NOT installed Web Api package "Microsoft.AspNet.WebApi".
I know that Core Controller combines MVC and Web Api functions for DNX Core, it can work without web api package. But DNX 4.5.1 also does not contain Web Api package. How will my app work on this platform (DNX 4.5.1)?
Thank you!
What about this Microsoft ASP.NET Web API 2.2 5.2.3 ?
This package contains everything you need to host ASP.NET Web API on
IIS. ASP.NET Web API is a framework that makes it easy to build HTTP
services that reach a broad range of clients, including browsers and
mobile devices. ASP.NET Web API is an ideal platform for building
RESTful applications on the .NET Framework.
Here is the link : Microsoft ASP.NET Web API 2.2 5.2.3
It looks like you are using ASP.NET 5 and MVC 6. In this case you don't need Microsoft.AspNet.WebApi (for MVC 4) nor Microsoft.AspNet.WebApi 2 (for MVC 5)
There is no more separate package for Web API in ASP.NET Core.
There is new combined package called Microsoft.AspNet.Mvc.Core (6.0.0-rc1-final)
Everything will work on both DNX 451 and DNX CORE

HelpPage for ASP.NET vNext MVC 6 Web Api

I am currently checking out asp.net vnext MVC6 in Visual Studio 2015 Preview. I'm pretty new to asp.net in general, but within my company we are going to move towards creating a web api using asp.net for accessing data on our server (currently we only support wcf communication with our own silverlight application). This is the reason I am checking out the new functionalities of MVC 6 to judge whether we should wait before starting our development and use MVC 6 when it is finally released or start development now and create a Web API 2 project.
Anyway, I am looking into auto documenting the web api, which is already integrated into the Visual Studio template for a WebApi 2 project by use of Microsoft.AspNet.WebApi.HelpPage.
Now for my question, is something like this available for MVC 6 aswell? I can import the same package in my project.json in my ASP.NET vNext / MVC6 (whatever you want to call it) project but i can't do app.UseHelpPage(); in my Startup.cs file.
I suspect this is not (yet) integrated in the current release yet. If not, is there anything known about integration of this feature once ASP.NET vNext eventually hits the shelves?
Probably this feature is not available in MVC 6 yet, but you could try Swagger.
Swagger basically is a framework for describing, consuming, and visualizing RESTful APIs.
The nice thing about Swashbuckle that it has no dependency on ASP.NET MVC, so there is no need to include any MVC Nuget packages in order to enable API documentation, as well Swashbuckle contains an embedded version of swagger-ui which will automatically serve up once Swashbuckle is installed.
Source: http://bitoftech.net/2014/08/25/asp-net-web-api-documentation-using-swagger/

ASP .Net VNext and Owin

I am exploring the features of ASP .NET VNext. In previous versions of .NET, Owin is used for self hosting of applications as well as hosting in any Owin compatible web servers including IIS. As per my understanding, ASP .NET VNext itself is host agnostic and has commands for self hosting of the application. Now, what is the place of Owin in ASP .NET VNext. I have seen many articles taking about Owin and Asp .NET VNext separately but I need to know how to put them together.
I am a beginner.Correct me if I am wrong.
You are right about your confusion. Whatever experience I have with ASP.net vnext (Mainly with VS 2015 Preview and VS 2015 CTP5).
Now let me share something you about OWIN and ASP.net vnext.
As per implementation of ASP.net vnext , OWIN type of pipeline integrated into that. In vnext there is interface called "IApplicationBuilder" and in OWIN "IAppBuilder"
As of now not all component build based on OWIN will not be used in ASP.net vnext but as time goes all component get transfered or have different version for vnext support. As of now in ASP.net vnext you can use Owin component by using IApplicationBuilder extention method UseOWIN.
https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.Owin/OwinExtensions.cs
If you look at Startup.cs file on VS 2015 Preview or CTP5 for ASP.net vnext project then you will get idea then it is somewhat similar concept like Middleware , Register to pipeline.
Surely there is difference between implementation but ASP.net vnext allow to run OWIN component.

Resources