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.