Over a million developers have joined DZone.

Build Robust and Cross-Platform Web Applications with ASP.NET 5

DZone's Guide to

Build Robust and Cross-Platform Web Applications with ASP.NET 5

· Cloud Zone ·
Free Resource

Learn how to migrate and modernize stateless applications and run them in a Kubernetes cluster.

The developers worldwide are building robust and scalable web applications using ASP.NET and with the release of the latest version, developers are quite excited about this. ASP.NET 5  is an open-source, cross-platform framework that promotes faster development and enables to build web applications for both the web and cloud. The latest version has been redesigned to provide a web application development platform with full side-by-side support for Linux and Mac.

ASP.NET 5 includes MVC 6 framework  and it combines the features of MVC and Web API features into a single web programming framework. The latest framework version of ASP.NET is built on the .NET core runtime and it can also run on full .NET framework as well.

ASP.NET 5 has the following improvements from the previous versions.

  • Built-in support for dependency injection
  • Cloud-based configuration
  • Side-by-side app versioning
  • Ability to host on IIS
  • Support for creating and using NuGet packages
  • Full .NET CLR support
  • Unified core framework
  • Faster development

Cross-Platform Support with Flexible Runtime

The latest feature of ASP.NET 5 is the cross-platform support. The applications run on Windows, Linux and Mac operating systems.

On creating a project in Visual Studio 2015, the developer can use full .Net CLR by default. This setting can be changed through the configuration properties of the project.

Dynamic Development

Dynamic compilation is available in Visual Studio 2015 that provides a streamlined developer experience. The developer no longer needs to compile the application every time to see the change. He or she just needs to edit the code, save the changes and run the application on the browser. Many other code editors can also be used to work on ASP.NET 5 projects.

HTML Helpers in the Views

ASP.NET 5 includes new tag helper feature that allows the developer to use HTML helpers in the views. This can be done by simply extending the tag semantics in the markup which simplifies customizing the output of HTML helpers.

MVC 6 –a Unified Programming Model

MVC provides a complementary functionality and it is used along with Web API and Web Pages while developing a solution. In the earlier versions, all the 3 models were used separately and the applications suffer from delicacies and inconsistencies. With the latest version of ASP.NET 5, a single application can be created that handle the web UI and data services without needing to reconcile the differences.

Razor views and content-negotiated data can also be returned from the same controller and same MVC filter pipeline.

View authorization can simply be done by tag helpers making them more natural and readable.

Fast HTTP Performance

The introduction of a new HTTP request pipeline allows adding only the components that are needed by the developer. The pipeline is no longer dependent on Web System. The developer is able to experience better output due to the reduced overhead in the pipeline.

In order to customize the components of the pipeline, the Configure method in the Startup Class can be used. The Configure method is used to specify the middleware that is to be used in the request pipeline.

Open Source

ASP.NET 5 is available as an open source project on GitHub . The developer can view the code, download the code and submit the changes. The open source framework will make it easier for them to understand the code.

Cloud Ready

The latest framework provides another feature of faster development of applications. The developers are excited to use this new feature. Moreover, the changes in the source code files can be saved and viewed on refreshing the web browser. The new framework is ready for the cloud and includes several features like diagnostics, session state and configuration and all these can work seamlessly on the premise and the cloud platform.

Dependency Management

The dependencies can be managed by NuGet packages  and the NuGet Package Manager can be used to list down the packages and versions that can be used in the project.

The project.json file is simple and easy to use and the developer can edit the file in a text editor also that allows updating the dependencies even when the app has been deployed on the cloud.

In VS 2015, IntelliSense assists the developer to find the available NuGet packages that can be added as dependencies.

Unified Core Framework

This is one of the fascinating features of ASP.NET 5. The developers can enjoy one unified core for ASP.NET MVC, ASP.NET Web API and ASP.NET Web Pages. Now, there will be only one type of controller for all kinds of requests and it will be common to all the 3 models. There is a single routing framework and one-filter pipeline as well.

The Future

With .NET arriving on Linux and Microsoft partnering with Docker, the way the developers deploy and host the .NET apps are going to be changed completely. The apps and the environment surrounding them can be built once and run everywhere. The containers will help the developers to manage the clusters and achieve high availability.

The existing code will continue to run as it did before on existing ASP.NET sites. The best part of the new version is that the overarching concepts with the existing versions are no lost at all. ASP.NET 5 is an evolution of the previous versions and allows the platform to continue on a more agile path. The modularity and more flexible design allow for greater innovation. Web technology is constantly changing in ASP.NET Development Company and the speed at which the changes are occurring continue to pick up. The new version allows the ASP.NET team and third parties to keep up with these changes more easily by extending the platform into the future.

Join us in exploring application and infrastructure changes required for running scalable, observable, and portable apps on Kubernetes.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}