ASP. NET 5 Overview (ASP. NET 5 overview)
ASP. NET 5Overview(ASP. NET 5 Overview)
Original: Tom fitzmacen)
Translator: MIS2000 Lab. (www.dotblogs.com.tw/mis2000lab /)
ASP. NET 5Introduction
ASP. NET 5 is a refined. NET stack (lean. NET Stock) used to build modern network applications. We build it step by step from the bottom layer and provide an optimized development architecture for various applications. You can build cloud applications or run both on the local machine .. NET Framework contains a variety of modular components with minimal energy consumption (minimal overhead), allowing you to build a variety of solutions flexibly.
ASP. NET 5 has the following features:
L brand new, elastic, and cross-platform operation (runtime ).
L brand new and modular HTTP Request pipeline (pipeline ).
L real-time available cloud environment settings.
L consistent design module, including MVC, Web API, and Web Pages (Translator's note: This is a Web page program written using Razor syntax, different from ASP. NET Web Form ).
L you do not need to recreate the project to see the differences between the versions before and after.
L complete corresponding (side-by-side). NET Framework versions.
L can operate on IIS or self-built host (self-host.
L all-new Visual Studio 2015 tool.
L open source code (Source Code) on GitHub ).
The changes we made for ASP. NET 5 are derived from the customer's requirements and feedback. These changes are designed to simplify the development, hosting, and maintenance of network applications.
Your old application can operate on the new ASP. NET version without any changes. However, to use the advantages of the new ASP. NET 5 function, you need to transfer the existing program code to the new architecture. You will find that there are many similarities between ASP. NET 5 and ASP. NET in earlier versions. Therefore, you only need to revise some specific topics for code transfer, rather than completely rewrite the application.
DownloadVisual Studio 2015 Preview
Download Visual Studio 2015 Preview (http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs download VS 2015 Preview) from here. For new features about VS 2015, see http://www.visualstudio.com/en-us/news/vs2015-preview-vs
Why redesignASP. NET?
More flexible and cross-platform operations
In the past,. NET Framework was a single, compatible (all-encompassing) fully installed. With the evolution of each. NET version, only new functions are added but few are deleted. Therefore, the capacity of this architecture is constantly increasing. This ensures that every Windows Host installed with. NET can support all types of. NET applications, but it also means that each application follows many features that it has never used.
If a. NET technology requires major updates, you will receive a notification that you are advised to update it even if you have not directly used this part of. NET. You must decide whether to install the update. During the update process, you may tolerate server interruption or ignore this update.
ASP. NET 5 provides you with more flexibility and can be executed in the following three conditions:
The complete. net clr is a preset project in Visual Studio. It provides the entire API set and is the best choice for backward compatibility of various versions.
Core (Core) CLR is a refined and complete module operation (runtime), used in five projects of ASP. NET. This CLR has been redesigned into components so that you can elastically include what you need in the application. You can add components through NuGet. After you finish, your application only uses the required features (you do not need to package a package for Haiti to include all the features ). By re-decomposing runtime for separate components, because each component update can have its own time schedule, we can provide some components that need improvement more quickly, you do not need to wait until all improvements are made ). As a result, the Core CLR is very streamlined, with only 11 MB, rather than the complete 200 MB. net clr. The core CLR can be deployed with your application, while the core CLR of different versions can run side-by-side (these two advantages are described in more detail below ).
In the future, we will release cross-platform runtime on Linux and Mac OS X operating systems. In the future, runtime of these versions will be developed and run on Mac and Linux devices. NET applications. We will work closely with the Mono community on cross-platform CLR. When published, you can use Mono CLR for cross-platform development. For more information, see developing ASP. NET vNext applications on Mac.
By default, the New Visual Studio project uses the complete. net clr. You can also define Core CLR in the project's set attributes (for example ).
ASP. NET 5 allows you to operate your applications on IIS or on your own host (self-host. After you lock (confirm) The Core CLR, You can bind an exclusive software suite for each subordinate application. Therefore, your application and the suite it depends on are completely independent (self-sufficiency, self-contained) and no longer dependent on existing (pre-installed) systems.. NET version. In the near future, all types of devices or host platforms will be able to execute your applications.
This new feature gives you more freedom. We still recommend that IIS be the best choice for hosts, but in some cases, you may need different host platforms. Now, you only need to deploy your project to the Host header. Your host attributes are no longer tied to the developed architecture, and vice versa.
For more examples, see Create a Web API in MVC 6.
Complete correspondence (Side-by-side) For different versions. NET Framework
When an application on a server depends on a single, fully installed. NET Framework, all applications must run the same version of. NET. Consider whether you want to upgrade to the new. NET Framework. Maybe you want some applications to use the latest. NET version, but you cannot determine whether all old applications can work with the new. NET version.
Fortunately, ASP. NET 5 solves this problem. You can customize the relevance in the "subordinate software suite", so you can define the. NET version required for "each application. You can get the benefits of the latest application, and you can easily make some applications run with the old version. Different Versions of. NET can run side-by-side without any problems. To run different versions, be sure to lock the Core CLR.
Simplify correlation (Simplify dependency management)
ASP. NET 5 introduces a new and lightweight way to manage project dependencies ). You no longer need to add assembly references in the project. Instead, you only need to manage these plug-ins through NuGet. You can use the NuGet software suite added by the NuGet Package Manager, or you can edit a JSON file (such as project. json packages) to control the NuGet software suite and version used in the project. To add other plug-ins, you only need to enter the NuGet kit name and version number to the project. json file (for example ).
In Visual Studio 2015, the intelligent selector System (intelliisense) can also find keywords of the NuGet software suite, such.
The preceding project. json file only contains the NuGet suite you want to add to the project. If the added NuGet suite is mutually dependent (related to each other) with other software suites, these associated suites will also be loaded, but will not be listed in the project. json file. This method makes your project. json file simpler and easier to manage. If you remove several NuGet suites from the project. json plugin, the associated suites are also deleted, provided that they are referenced if no other suites exist.
Even if you have not installed Visual Studio, the JSON format above allows you to manage dependencies between software suites (plug-ins) more easily. You can open the project. json file in any text editor and modify it. For example, you can update applications deployed on the cloud and their software suite dependencies.
EliminateMVC,Web APIAndWeb PagesBetween
In the past, MVC, Web APIs, and Web Pages have many overlapping features, but their implementations are independent of each other. (Note: Web Pages are Web programs written using Razor syntax, with ASP.. NET Web Form ). For example, both MVC and Web APIs provide the routing function, but the MVC routing category is placed in System. web. mvc. the Routing namespace, while the Web API is in the System. web. http. routing namespace. Alternatively, both Web Pages and MVC use the Razor syntax, but some NuGet suites are only compatible with (MVC or Web Pages.
In ASP. NET 5, MVC, Web API, and Web Pages are merged into a. Single architecture named MVC 6. This merge eliminates repeated architectures, making it easier for you to develop applications that use these architecture frameworks. You do not need to write similar program code in order to check whether it is in the relationship between MVC, Web API, or Web Pages.
In the VS 2015 preview version, MVC and Web APIs are already unified in MVC 6. Web Pages will be added to the next release version of MVC 6.
ASP. NET 5 introduces a new HTTP Request pipeline (pipeline) which is simplified and fast. This pipeline is modular, so you can add only the components you need. By reducing the consumption of pipelines, your applications will experience better throughput traffic ). The new mps queue also supports OWIN.
Available on the cloud now
When you create an ASP. NET 5 Project, the inherent structure of this project is to be deployed in the cloud environment. Visual Studio 2015 provides a completely new environment setting system, which replaces the existing Web. config environment. The new system allows you to request named values from various sources (such as JSON, XML, or environment variables. You can specify a value for each environment or allow your application to read the correct value after deployment.
We also provide diagnostic and tracing tools to make it easier for you to discover Application Problems on the cloud.
Dependency injection (DI) is also built in ASP. NET 5. You can use the Inversionof Control (IoC) container to register these dependencies. Dependency injection (DI) is conducive to providing correct services to the environment. For more information, see Dependency Injection in ASP. NET vNext.
Open source code and transparency
All ASP. NET 5 program code is put on GitHub. Not only is the program code available, but GitHub repositories is also integrated into our development. You can clearly see the changes made by. NET. After each change, you can download the program code and submit the corrected results.
Developing ASP. NET 5 on GitHub makes it easier for you to understand program code, understand our expected development direction, and help you enhance and build ASP. NET functions that you want to customize.
More flexible development environment
Visual Studio 2015 provides a lightweight developer experience for ASP. NET applications. You only need to change your program code, save the disk, and then refresh the browser screen (for example ). You can see the modification results in the Web browser without the need to re-build the project.
For example, if the program code you change is in a Web project or a category library referenced in your project. You still have to execute the (CTRL + F5) project, instead of seeing these dynamic changes in debug mode.
Visual Studio uses the Roslin (Roslyn) compiler to start this dynamic compilation. You still have the structure and power to compile the architecture, but the development experience is more like an Interpreted language.
Each function in the Visual Studio User Interface (UI) can correspond to command-line operations. You can easily convert between a user interface and a command-line script.
Finally, you can use other program code editors to complete your ASP. NET 5 project.
Web FormWhat's wrong?
You can continue to develop Web Form applications and are confident that Web Form is an important part of. NET Web development platform. We will continue to work on new features to improve development experience with Web forms and maintain the latest network practices.
Web Form 4.6 includes the following new features of WebForm:
L HTTP 2
L asynchronous step Model Binding (Async. Model Binding)
L Roslin (Roslyn) CodeDOM Compilation Program
Your existing Web Form applications will continue to run in. NET 4.6 without changing to IIS. However, you cannot use the Web Form application on the cloud-optimized (optimized for the cloud) runtime.
For new features of Web Form 4.6, see Web Forms 4.6. For more information about recent changes to Web Form in Visual Studio 2013 Update2, see Improvements to ASP. NET Web Forms.
What about previous applications?
You may worry that as the ASP. NET 5 version numbers change, you need to rewrite all applications. Don't worry! The ASP. NET application you created in earlier versions will continue to work with the new. NET architecture. If you do not need new ASP. NET 5 features, you do not need to update or re-post (install) these applications.
For example, if your application currently uses Web Form, MVC 5, Web API 2, SignalR 2, Web Pages 3, or Entity Framework 6, it can be completely unmodified, complete support for the new architecture. However, you may need to use "full. net clr" to execute these old versions of applications, because only this (full version) CLR provides full compatibility with earlier versions.
The cloud-optimized (optimized for the cloud) runtime provides many restricted API interfaces. When using cloud-optimized runtime, the application must use only the types and members dedicated to this runtime.
Do you want to know if your application can be executed in cloud-optimized runtime? Use the API Portability Analyzer tool for detection. This tool will tell you which platform applications can target and avoid the dependency generated when the applications are moved to another platform. It helps you understand the scope of change and propose new types or members to replace software suites that are not supported.
Applications of MVC 6 and SignalR 3 use the new HTTP pipeline, so they are not compatible with applications that use System. Web. To upgrade an existing application to mvc 6 or SignalR 3, you must create a new project through Visual Studio 2015 and then port your program code to the new project. When you move to the new version, you may need to modify some unsupported program code.
After reading this article, you can continue to refer to the following content:
The following videos (video introduction) describe the latest enhancements:
ASP. NET 5Overview(ASP. NET 5 Overview)
Original: Tom fitzmacen)
Translator: MIS2000 Lab. (www.dotblogs.com.tw/mis2000lab /)