Introduction of ASP.NET 5.0
ASP.NET 5 is built from the ground up and leaning towards legacy of .NET family to build modern web applications. Newly added features in ASP.Net 5.0 are built based on the customer requests and feedback to achieve optimized development framework for applications that are meant to be deployed or to be run in local premises. ASP.Net consists of compact components with negligible overhead so developers can feel flexibility while constructing their applications.
Introduced changes in ASP.Net 5.0 are precisely targeted to create modern web applications. These changes will certainly simplify development process, web hosting, and maintenance of applications. Legacy applications will run on the new version of the ASP.NET without any modifications. However, in order to take advantage of the new features in ASP.NET 5, you need to port your code to the new framework.
Features of ASP.NET 5
Combination of MVC, Web API, and Web Pages in single programming model
In ASP.NET 5, MVC, Web API, and Web Pages are bundled into a single framework called MVC 6. This approach removes duplication from the framework and makes it easier for developers to build apps. Hence, no need to write different code depending on whether you are within an MVC, Web API, or Web Pages context.
Use different .NET Framework side-by-side
When your application depends on a specific version of .NET Framework, your all apps have to run the same version of .NET. In case, you want some of your apps to use the latest version of .NET, you may feel unsure whether all of your legacy apps would work appropriately with the new version.
To overcome this situation, with ASP.NET 5 you can define the dependencies within your deployment package so you can specify for each app which version of .NET to use. You can enjoy benefits of the latest .NET version for some apps with sticking up with older .NET version for other apps. All of these different versions of .NET can be run side-by-side without any problems.
Ability to self-host or host on IIS
ASP.NET 5 provides the flexibility to host your application on IIS or self-host it in your own process. When you build the application targeting the Core CLR, you can deploy it with every dependency bundled within the deployment package. Hence, your application and its dependencies are completely self-contained and independent of system installation of .NET. This new capability give you freedom to host your app on any type of device or hosting platform. All you need to do is just deploy your project to that host.
Check changes in browser without re-building the project
Visual Studio 2015 provides a lightweight developer experience for ASP.NET applications. Just make changes in your code, save them and refresh the browser. You can see code changes in the web browser without re-building the project.
New flexible and cross-platform runtime that can run on OS X and Linux with the Mono runtime
Previously, the .NET Framework was delivered as a single installation. Gradually features were added with each release of .NET but never removed. Thus, size of the framework constantly grew. This approach will ensure that a .NET installed Windows machine will support every .NET app, but it may possible that each application is not using all installed features.
ASP.NET 5 gives you greater flexibility providing you with three runtimes:
- Full .NET CLR: The full .NET CLR is the default runtime for Visual Studio projects. It is the best option for backward compatibility as it provides the entire API set.
- Core CLR (cloud-optimized runtime): The Core CLR is a pure modular runtime for ASP.NET 5 projects. It has been designed into components so you just need to include only required features in your app. The Core CLR is about 11 MBs instead of around 200 MBs for the full .NET CLR.
- Cross-Platform CLR: Microsoft will release a cross-platform runtime for Linux and Mac OS X. It will enable you to develop and run .NET apps on Mac and Linux machines. Until its release, you can use the Mono CLR for cross-platform development. By default, Visual Studio projects use the full .NET CLR. You can specify the Core CLR in the configuration properties for your project.
Modular HTTP request pipeline for highest throughput
With ASP.NET 5, new HTTP request pipeline is introduced which is modular and fast. Using this new pipeline, you will be able to add only components those are required to run your application. This approach reduces the overhead in the pipeline so you will get improved output from your application.
Dependency management through NuGet package manager
With ASP.NET 5 you can manage dependencies in your projects in a way that there is no need to add assembly references to your project. Instead, you can add NuGet packages through NuGet Package Manager or you can edit the JSON file (project.json) that lists the NuGet packages and versions used in your project. To add dependencies, you can simply type name and version number of the NuGet package into your project.json file.
The project.json file only includes NuGet packages that are directly added to your project. If you add a NuGet package that is dependent on some other packages, those secondary dependencies are loaded but not listed in the project.json file. This approach will keep project.json file less clumsy and easier to manage. You can add dependency in Project.json file through any text editor.
Cloud-optimized environment configuration
Projects built on ASP.NET 5 are highly optimized for the cloud platform to achieve easy deployment. Visual Studio 2015 introduces a new environment configuration in place of Web.config file. It can request named values from a variety of sources (such as JSON, XML, or environment variables). You can specify values for each environment, and after deployment your app simply reads the correct values.
Open source through the .NET Foundation, and takes contributions in GitHub
Entire ASP.NET 5 code is available at GitHub. GitHub will be used as repositories for all development so you can see what changes were made and when they were made. You can download the code, build your own customized implementations of ASP.NET features and submit changes at GitHub.
No worries for Legacy applications
Applications that you built on earlier versions of ASP.NET will continue to work with the new .NET Framework. You do not need to update or port these applications if you do not need the new features in ASP.NET 5.
Certainly, Microsoft has made some revolutionary design level changes in ASP.NET 5 to develop modern web apps. The most attractive part of ASP.NET 5 is that it is fully open source and available on GitHub. Microsoft has developed ASP.NET 5 on GitHub so developers can understand the code and contribute in its enhancements. By making ASP.Net open source, Microsoft has invited to communities and developers to download the code and build their own customized implementations of ASP.NET.
Latest posts by Rahul Vaghasia (see all)
(Visited 11 times, 1 visits today)