ASP. NET 5 Series tutorials

Source: Internet
Author: User
Tags http 2

ASP. NET 5 Series tutorials

ASP. NET 5 is the framework used to create Web applications. It is more concise and flexible than the previous version. The released version completely optimizes the application development framework, you can easily deploy applications to the cloud or other platforms. It includes the smallest modular components, so make sure you maintain flexibility while building complex solutions.

Microsoft has released ASP. NET 5.0, the new feature demand of this release comes from the feedback and needs of a large number of users, such as flexible cross-platform runtime and self-deployment capabilities to enable ASP. NET Applications are no longer limited by the IIS and Cloud-ready environment configurations, which lowers the Cloud deployment threshold. In addition, open source code is undoubtedly a heavyweight surprise. These changes help you create Web applications that are easy to develop, deploy, maintain, and modern. I believe that you can't wait to experience the new functions of ASP. NET 5 as a. NET programmer. Let's take a look at these new features.

ASP. NET 5 is the framework used to create Web applications. It is more concise and flexible than the previous version. The released version completely optimizes the application development framework, you can easily deploy applications to the cloud or other platforms. It includes the smallest modular components, so make sure you maintain flexibility while building complex solutions.

ASP. NET 5 has the following features:

· Flexible cross-platform Runtime

· New HTTP module request Pipeline

· Cloud-ready environment Configuration

· Unified programming models including MVC, Web API, and Web pages

· You do not need to re-compile to view the change results.

· Parallel. NET Framework Version

· Independent deployment or IIS deployment capability

· New tools embedded in Visual Studio 2015

· GitHub open source code

Applications developed using earlier versions can run on ASP. NET 5 without any modifications. However, to use the new ASP. NET 5 feature, you need to port existing code to the new framework. ASP. NET 5 and earlier ASP. NET versions are basically the same. Therefore, you only need to focus on new function development, saving your code migration time.

The above general introduction of ASP. NET 5 new features and enhancements.

This article focuses on the following points:
  • Why re-design ASP. NET?

  • Flexible cross-platform runtime requirements

  • Flexible Deployment Environment

  • Concurrent Use of multiple frameworks

  • Simplify dependency management

  • Merge MVC, Web API, and Web pages

  • Enhancing HTTP Performance

  • Cloud-ready deployment capability

  • Integration dependency Injection

  • Open Source

  • Provides an agile development environment

  • About Web Forms

  • Compatibility with earlier versions of Framework development applications

Why re-design ASP. NET?

Flexible cross-platform runtime requirements

Early. the. NET Framework version has been installed as a single and comprehensive whole. Each new version contains new features and almost all early functions, but is rarely deleted, this inevitably leads to an increase in the volume of the Framework. This mode ensures that Windows systems with the new Framework installed are compatible with all earlier versions. NET application, but it also means that each application will run on a large redundant framework, even if many features are not used in real projects.

Believe each. NET programmers have encountered the following embarrassing decision-making scenarios: when the Framework is notified of an update and release, whether to stop using new features to maintain application flexibility or use new features makes your Framework more huge!

To cope with the above scenarios. ASP. NET 5 provides three runtime options:

1. full-featured. NET CLR
Full function. net clr is the default runtime status of the Visual Studio project. It provides all APIs and is the best choice to maintain downward compatibility of applications.

2. Core CLR (cloud-optimized runtime)
Core CLR is a streamlined, fully modular runtime. This CLR has been redesigned as a component so that you can only include the. NET features actually used in the project. Add the component as the NuGet package. Once the reference is completed, your application only depends on the required features. By splitting runtime components, we can change each component faster because each component has a self-updating mechanism. The core CLR is only 11 Mb in size. Compared with the full-featured CLR of MB, the core CLR will undoubtedly make the application lighter. Core CLR can be deployed along with applications, and different core CLR can run in parallel.

3. cross-platform CLR
Microsoft will launch cross-platform runtime for Linux and Mac OS X. This means that your. NET application is capable of running on Mac and Linux devices. Microsoft will work with the Mono community to complete this new feature. Before the release, you can use Mono CLR for cross-platform development.

By default, the full function. net clr is used to create a new Visual Studio project. You can change it to the core CLR on the project properties page.

Flexible Deployment

ASP. NET 5 allows application deployment to IIS, or independent deployment from IIS. When the target Framework is set to Core CLR, you can use the dependencies in the deployment package to deploy the application. Therefore, your application is self-contained and does not rely on the full-featured. NET version. This application can run on any device or platform.

This pair. NET platform developers are no doubt a surprise. Deploying applications is not limited to IIS. Of course, Microsoft still recommends that you deploy applications using IIS. However, if you need to deploy applications on a platform that is not compatible with IIS, you can use this new feature to perform operations.

In subsequent articles, we will release how to create MVC6 applications that do not depend on IIS.

Concurrent Use of Multi-version. NET

Earlier versions. NET Framework, you will always be faced with the choice of whether to update the version. On the one hand, you want to use the UPDATE function, on the other hand, you will be able to smoothly migrate the project developed for the old version to the new version. NET Framework.

Microsoft has improved the above problems in ASP. NET 5. With the core CLR, you can define dependencies in the deployment package, so you can specify the. NET version for each application. The old application can run smoothly, and you can also use the new version to develop the application. Therefore, the. NET Applications of multiple versions in ASP. NET 5 are parallel.

Simplify dependency management

ASP. NET 5 introduces a new lightweight dependency relationship management mechanism. Instead of adding a reference to an application, you can use the NuGet package instead. You can add a NuGet Package through the NuGet Package manager, or edit a JSON file containing the NuGet Package list and version information (project. json) for reference. The project. json file is used to list NuGet-related information used by the application. To add other references, add them directly to the JSON file.

In Visual Studio 2015, you can quickly add NuGet packages based on smart prompts.

The project. json file only contains the NuGet package directly added to the project. If a package other than the Referenced File is added, such dependencies will only be loaded and will not be displayed in the project. json file. This mechanism makes the project. json file easy to manage.

JSON files allow you to easily manage references without installing Visual Studio. Of course, you can use any text editor to open and edit project. json.

Merge MVC, Web API, and Web pages

In earlier versions, MVC, Web APIs, and Web pages have been implementing the same functions in different ways. For example, both MVC and Web APIs provide routes, but the MVC routing class is in the System. web. mvc. in the Routing namespace, while in the Web API, similar classes are in the System. web. http. routing namespace. For another example, both Web pages and MVC have the Razor syntax, but they are still included in different NuGet packages with the same function.

In ASP. NET 5, MVC, Web API, and Web page are integrated into the same framework-MVC 6. This means that the repeated functional modules are removed to simplify application development.

In the preview version, MVC and Web APIs are first merged into MVC 6. The Web page will be added later in subsequent releases.

Enhancing HTTP Performance

ASP. NET 5 provides a refined and fast HTTP request pipeline that allows you to add only the required components. by reducing the overhead of the pipeline, applications will have better throughput.

Cloud deployment capability

When you create a new ASP. NET 5 project, this project has a structure that can be easily deployed to the cloud by default. Visual Studio 2015 provides a new environment configuration system to replace the Web. config file. The new system allows multiple file types (such as JSON, XML, or environment variables) to store key-value pairs. Therefore, you can easily specify or obtain these values in any environment.

ASP. NET 5 provides a tool to detect and track problems with deployed cloud applications.

Integration dependency Injection

Dependency injection is embedded in ASP. NET 5. You can use the IoC container to register dependencies. Dependency injection promotes the provision of the correct service environment.

Open Source

ASP. NET source code has been released to GitHub. Not only does the source code of the current version be provided, but Microsoft also promises to synchronously update the source code in GitHub. You can view ASP. NET changes in time, download the changes, and submit the changes to GitHub.

This helps you understand ASP. NET code and technology trends, and you can customize your own ASP. NET.

Provides an agile development environment

Visual Studio 2015 provides a lightweight ASP. NET development environment. You do not need to re-compile the project. You only need to save the changed code to view the latest results in the browser.

The code you changed can be in a Web project or a class library referenced by the current Web project.

Visual Studio uses the Roslyn compiler to allow dynamic compilation. Make sure that you have a complete and powerful compilation framework and a development experience similar to the explanatory language.

Each Visual Studio user interface has a corresponding script, so you can easily switch between the UI interface and script.

Finally, you can use another code editor to edit the ASP. NET 5 project.

About Web Forms

Microsoft has been committed to providing users with new features to improve the development experience. You can still develop Web Forms applications and add the following new features in Web Forms 4.6:

  • HTTP 2

  • Asynchronous binding mode

  • Roslyn CodeDOM Compiler

Web Forms applications developed in earlier versions can run directly under the IIS. NET 4.6 framework without any changes. However, the new core CLR features of ASP. NET 5 cannot be used.

For example, an application is currently developed using Web Forms, MVC 5, Web API 2, SignalR 2, Web Pages 3, or Entity Framework 6, you only need to set the current runtime version to full-featured runtime without any code-level modifications.. NET 5. However, the core CRL is a new feature of ASP. NET 5. If you want your application to have the runtime function, you need to make some modifications. Microsoft provides the API Portability Analyzer tool to determine whether the current application can use the core CRL. This tool also analyzes the platforms on which the current application can run and the factors that prevent it from running on a specific platform. The required changes and new interfaces are also prompted.

MVC 6 and SignalR 3 applications use new HTTP pipelines, so they cannot be compatible with applications that use the System. Web interface. To upgrade an existing application to mvc 6 or SignalR 3, you must use Visual Studio 2015 to create a new project and then import the original project. During the import process, you must modify unsupported code snippets.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next Page
[Content navigation]
Page 1: Reading New Features Page 1: Hello World
Page 3rd: view components Introduction Page 4th: add services to the view and publish applications to the public cloud
Page 5th: Use Grunt, Bowe in Visual Studio 2015 Page 1: create a Web API in MVC6
Page 1: Conclusion-interpreting code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.