[Translation] Introduction to ASP.NET Core

Orignal Link: Introduction to ASP.NET Corehtml

09/13/2018linux

The following content typing by hands. nginx

 

asp.net core 是一個跨平臺,高性能的開源框架, 它能構建 現代的,基於雲的,互聯網交互的 應用。web

使用asp.net core, 你能夠:docker

* 構建 web 應用和服務, 物聯應用, 和移動後端。編程

* 使用你喜歡的開發工具基於操做系統( Windows, MacOS, Linux )windows

* 部署到雲端 或 內網後端

* 運行在 .NET Core 或 .NET Framework上api

 

爲何使用 asp.net core?瀏覽器

Millions 開發者使用了(繼續使用) asp.net 4.x 建立web應用. asp.net core 是從新設計的asp.net 4.x,  伴隨的是架構的變動( result in a leaner? 更加模塊化的框架 )

 

asp.net core 提供瞭如下幾點優勢:

* 一個統一的方式去構建 web UI and web apis.

* 與現代開發的集成, 客戶端框架 和 開發工做流程.

* 一個爲 雲準備, 基於environment的配置系統

* 內建 DI

* 一個輕量級,高性能和模塊化 http請求管道.

* 可以宿主在iis, nginx, apach,docker 或自主機 在你的進程?.

* (Side-by-side app versioning) 獨立的版本,若是是基於.net core

* 爲了簡單的現代web開發提供工具

* 開發和運行在 Windows, macOS, linux 上

* 開源 而且 關注社區的聲音

asp.net core 在nuget包中,  使用Nuget包優化你的app,只須要必須的依賴, 事實上, asp.net core 2.x  (基於.net core) 只須要單個nuget包依賴. 

一個看上去更簡單的app包含了 更嚴格的安全,  減小了維護 而且是 高性能的.

 

使用asp.net core mvc構建 web APIs和 web UI

asp.net mvc 提供了功能去構建APIs和apps:

*  MVC 去幫助構建你的可測試的 api和app

* Razor頁( asp.net core 2.0起) 頁面級的編程模型, 能輕易的構建ui和更高的生產力.

* Razor標記 提供了一個更高生產力的語法給Razor頁和mvc視圖.

* Tag Helpers 能在服務端代碼中參與Razor文件中 建立和渲染html 元素.

* 內置支持多數據格式和協商內容(content negotiation) 讓你的api接口能取得普遍的客戶端數據, 保護瀏覽器和移動端。

* 模型綁定(Model binding) 自動映射數據從 http請求中到 action方法的參數

* 模型驗證 自動執行(performs) 客戶端和服務端驗證

客戶端開發

asp.net core 無縫的集成了流行的客戶端框架和庫, 包含了Angular, React, 和 Bootstrap, 須要更多信息, 請看客戶端開發.

asp.net core 基於 .NET Framework

asp.net core開源基於.net core 或者.net framework. asp.net core應用基於.net framework不能跨平臺, 只能運行在windows上. 並且並無計劃刪除對.net framework的支持.

總來的說,asp.net core 由.net standard庫組成(made up of), 應用編寫在.net standard2.0 能夠運行在任意支持.net standard2.0 的地方?

 

基於.net core由不少優點, 各個版本都有優點 , .net core 比 .net framework 好在:

* 跨平臺 ..

* 更好的性能

* 獨立版本支持

* 新的api集

* 開源

咱們很努力的減小.net core與.net framework的差別。 ‘Windows Compatibility Pack’ 作上千個windows-only的api在.net core中。 這些api不能在.net core 1.x中使用。

 

ASP.NET Core is a cross-platform , hight-performance, open source framework for building modern, cloud-based, Internet-connected applications. With ASP.NET Core, you can:

* Build web apps and Services, IoT apps, and mobile backends.

* Use your favorite development tools on Windows, macOS, and Linux.

* Deploy to the cloud or on-premises.

* Run on .NET Core or .NET Framework.

 

Why use ASP.NET Core?

Millions of developers have used(and continue to use) ASP.NET 4.x to create web apps. ASP.NET Core is a redesign of ASP.NET 4.x, with architechural change that result in a leaner, more modular framework.

 

ASP.NET Core providers the following benefits:

* A unified story for building web UI and web APIs.

* Intergration of modern, client-side frameworks and development workflows.

* A cloud-ready, environment-based configuration system.

* Built-in dependency injection.

* A lightweight, high-performance, and modular HTTP request pipeline.

* Ability to host on IIS, Nginx, Apache, Docker, or self-host in your own process.

* Side-by-side app versioning when targeting .NET Core.

* Tooling that simplifies modrn web development.

* Ability to build and run on Windows, macOS, and Linux.

* Open-source and community-focuesd.

 

ASP.NET Core ship entirely as Nuget packages. Using NuGet packages allow you to optimize you app to include only the necessary dependencies. In fact, ASP.NET Core 2.X apps targeting .NET Core only require a single NuGet package. The benefits of a smaller app surface area include tighter security, reduced servicing, and improved performance.

 

Build web APIs and web UI using ASP.NET Core MVC

ASP.NET Core MVC provides features to build web APIs and web apps:

* The Model-View-Controller(MVC) pattern helps make your web APIs and web apps testable.

* Razor Pages(new in ASP.NET Core 2.0) is a page-based programing model that makes building web UI easier and more productive.

* Razor markup provides a rpoductive syntax for Razor Pages and MVC views.

* Tag Helpers enable server-side code to participate in creating and rending HTML elements in Razor files.

* Built-in support for multiple data formats and content negotiation lets you web APIs reach a broad range of clients, including browsers and mobile devices.

* Model binding automatically maps data from HTTP requests to action method parameters.

* Model validation automatically performs client- and server-side validation.

 

 Client-Side development

ASP.NET Core integrates seamlessly with popular client-side frameworks and libraries, including Angular, React, and Bootstrap. For more information, see Client-side development.

 

ASP.NET Core targeting .NET Framework

ASP.NET Core can target .NET Core or .NET Framework. ASP.NET Core apps targeting .NET Framework aren't corss-platform they run on Windows only. There are no plans to remove support for targeting .NET framework in ASP.NET Core. Generally, ASP.NET Core is made up of .NET Standard libraries. APPs written .NET Standard 2.0 run anywhere that .NET Standard 2.0 is supported.

 

There are several advantages to targeting .NET Core, and thses advantages increase with each release. Some advantages of .NET Core over .NET Framwork include:

* Coress-platform. Runs on macOS, Linux, and Windows.

* Improved performance

* Side-by-side versioning

* New APIs

* Open source

 

We're woking hard to close the API gap from .NET Framework to .NET Core. The Windows Compatiblility Pack made thousands of Windows-only APIs available in .NET core. These weren't available in .NET Core 1.x.

相關文章
相關標籤/搜索