The next version of ASP.NET (“ASP.NET vNext”) has been redesigned from the ground up.
The goal is to create a lean and composable .NET stack for building modern cloud-based apps.
You don't have to use Visual Studio to develop ASP.NET vNext applications.
You can develop and run vNext on platforms that Visual Studio doesn't run on.
Few New Releases:
1. .NET Compiler Platform ("Roslyn")
2. .NET Next Generation JIT (“RyuJIT”).
Introduction to ASP.NET vNext
Here are some of the new features in ASP.NET vNext.
ASP.NET vNext includes updated versions of MVC, Web API, Web Pages, SignalR and EF - ASP.NET vNext (MVC, Web API and Web Pages 6; EF 7; SignalR 3)
Intro:
- ASP.NET vNext includes updated versions of MVC, Web API, Web Pages, SignalR and EF.
The key improvement with these frameworks is that MVC, Web API and Web Pages have been merged into a single programming model. For example, there’s now unified controller and routing concepts between all three. You can now have a single controller that returns both MVC views and formatted Web API responses, on the same HTTP verb.
- ASP.NET vNext apps are cloud ready by design. Services such as session state and caching adjust their behavior depending on whether the app is running in the cloud or in a traditional hosting environment, while providing a consistent API.
- We use dependency injection behind the scenes to provide your app with the correct implementation for these services.
Using this approach, it is really easy to move your app from on-premises to the cloud, since our code changes, not yours.
- You will be able to make changes to your web applications and see the results after a browser refresh, with no separate build step needed. This significant productivity enhancement is based on improvements to load times in the underlying CLR, as well as use of the new .NET Compiler Platform ("Roslyn").
Rebuilt from the Ground Up
- MVC, Web API, and Web Pages are merged into one framework, called MVC 6. The new framework uses a common set of abstractions for routing, action selection, filters, model binding, and so on.
I.e. There’s now unified controller and routing concepts between all three. You can now have a single controller that returns both MVC views and formatted Web API responses, on the same HTTP verb.
- Dependency injection is built into the framework. Use your preferred IoC container to register dependencies.
- vNext is host agnostic. You can host your app in IIS, or self-host in a custom process. (Web API 2 and SignalR 2 already support self-hosting; vNext brings this same capability to MVC.)
- vNext is open source and cross platform.
Leaner, Faster
- MVC 6 has no dependency on System.Web.dll. The result is a leaner framework, with faster startup time and lower memory consumption.
- vNext apps can use a cloud-optimized runtime and subset of the .NET Framework. This subset of the framework is about 11 megabytes in size compared to 200 megabytes for the full framework, and is composed of a collection of NuGet packages.
- Because the cloud-optimized framework is a collection of NuGet packages, your app can include only the packages you actually need. No unnecessary memory, disk space, loading time, etc.
- Microsoft can deliver updates to the framework on a faster cadence, because each part can be updated independently.
True Side-by-Side Deployment
The reduced footprint of the cloud-optimized runtime makes it practical to deploy the framework with your app.
- You can run apps side-by-side with different versions of the framework on the same server.
- Your apps are insulated from framework changes on the server.
- You can make framework updates for each app on its own schedule.
- No errors when you deploy to production resulting from a mismatch between the framework patch level on the development machine and the production server.
New Development Experience
vNext uses the Roslyn compiler to compile code dynamically.
- You can edit a code file, refresh the browser, and see the changes without rebuilding the project.
- Besides streamlining the development process, dynamic code compilation enables development scenarios that were not possible before, such as editing code on the server using Visual Studio Online ("Monaco").
- You can choose your own editors and tools.
ASP.NET vNext is being rewritten from the ground up, and while much of your code for vNext will look the same.
vNext is not backwards compatible with existing ASP.NET applications.
However, the current frameworks (Web Forms 5, MVC 5, Web API 2, Web Pages 3, SignalR 2, and Entity Framework 6) will continue to ship in Visual Studio, and will be fully supported in ASP.NET vNext.
Summary:
The table below outlines the ASP.NET vNext scenarios we’ve built and where they are available.
ASP.NET vNext Feature | On .NET vNext | On .NET vNext (Cloud Optimized) |
Cloud Ready | * | * |
Modular Design | * | * |
Dependency Injection | * | * |
Consistent Tracing / Debugging | * | * |
Faster Development (browser refresh) | * | * |
Open Source | * | * |
Full Side by Side (runtime and framework | | * |
Faster startup, Lower memory / Higher throughput (best of class) | | * |
Uses a smaller set of framework libraries | | * |
Enabled on Mono, on Mac and Linux | | * |
ASP.NET vNext will be open source and will be contributed to the .NET Foundation. This shouldn’t come as a big surprise since the ASP.NET Web stack is already open source. All of ASP.NET vNext will be delivered via NuGet, will be open source and will take contributions. Read ASP.NET vNext: the future of .NET on the Server to learn more.
Our announcement at TechEd is the first stop for .NET vNext and ASP.NET vNext. We’ll share much more in the months to come before we release the final versions. We’re looking forward to shipping pre-release versions in order to get your feedback.
Code View:
project.json
The project.json file contains a list of dependencies for the project and a list of build output configurations.
It can also include a list of commands.
The project.json file also specifies build output framework configuration options.
{
"dependencies": {
"Microsoft.AspNet.Server.IIS" : "1.0.0-alpha3",
"Microsoft.AspNet.Mvc": "6.0.0-alpha3",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-alpha3",
"Microsoft.AspNet.Identity.Authentication": "3.0.0-alpha3",
"Microsoft.AspNet.Security.Cookies": "1.0.0-alpha3",
"Microsoft.AspNet.Server.IIS": "1.0.0-alpha3",
"Microsoft.AspNet.Server.WebListener": "1.0.0-alpha3",
"Microsoft.AspNet.StaticFiles": "1.0.0-alpha3",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-alpha3",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0-alpha2",
"Classlibrary1": ""
}
"frameworks": {
"net45": { },
"k10": { }
}
}
Commands
The project.json file can also contain commands that facilitate running the application from the command line.
For example:
{
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
}
}
Startup.cs
By default, the vNext hosting environment expects to find a startup class named Startup.
This class must contain a Configure method that takes an IBuilder parameter, and you configure the HTTP pipeline inside this Configure method. The empty project creates the class with nothing in the Configure method.
using System;
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace HelloWorld
{
public class Startup
{
public void Configure(IBuilder app)
{
app.UseServices(services =>
{
services.AddMvc();
});
app.UseMvc();
}
}
}
Here - AddMvc method adds the MVC framework services to the dependency injection system.
The UseMvc method configures MVC default settings such as routes.
Config.json - vNext configuration
The template creates a config.json file to store application settings such as database connection strings:
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=(localdb)\\mssqllocaldb;Database=aspnetvnext-HelloWorld2-f0652fd2-febf-488d-955b-b4c590e536f1;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}
}
References:
http://www.asp.net/vnext/overview/aspnet-vnext/getting-started-with-aspnet-vnext-and-visual-studio
http://blogs.msdn.com/b/dotnet/archive/2014/05/12/the-next-generation-of-net-asp-net-vnext.aspx
http://blogs.msdn.com/b/webdev/archive/2014/08/12/develop-asp-net-vnext-applications-on-a-mac.aspx
Hope this helps.
Regards,
Arun Manglick
No comments:
Post a Comment