官术网_书友最值得收藏!

What's new in ASP.NET Core 2

ASP.NET Core 2 takes advantage of all the improvements to .NET Core 2, if that is what you choose to run it on. It will also run on .NET Framework 4.7, but it's best to run it on .NET Core if you can. With the increase in scope and support of .NET Core 2, this should be less of a problem than it was previously.

.NET Core 2 includes a new metapackage, so you only need to reference one NuGet item to get all the things. However, it is still composed of individual packages, if you want to pick and choose. They haven't reverted to the bad old days of having one huge System.Web assembly. A new package-trimming feature ensures that if you don't use a package, then its binaries won't be included in your deployment, even if you use a metapackage to reference it.

There is also a sensible default for setting up a web host configuration. You don't need to add logging, Kestrel, and IIS individually anymore. Logging has also gotten simpler and, as it is built in, you have no excuses not to use it from the start.

A new feature is support for controllerless Razor Pages. This is exactly what it sounds like, and it allows you to write pages with just a Razor template. It is similar to the Web Pages product, not to be confused with Web Forms. There is talk of Web Forms making a comeback; if this happens, then hopefully, the abstraction will be thought out more and it won't carry so much state around with it.

There is a new authentication model that makes better use of dependency injection. ASP.NET Core Identity allows you to use OpenID and OAuth 2 and get access tokens for your APIs. You may also want to investigate the Identity Server 4 project that provides a lot of similar functionality.

A nice time saver is that you no longer need to emit anti-forgery tokens in forms (to prevent Cross-Site Request Forgery) with attributes to validate them on post methods. This is all done automatically for you, which should prevent you from forgetting to do this and leaving a security vulnerability.

主站蜘蛛池模板: 正定县| 龙泉市| 鹤庆县| 永清县| 且末县| 眉山市| 福建省| 玉屏| 长白| 吉隆县| 扬州市| 江油市| 阿瓦提县| 资溪县| 略阳县| 如东县| 阳朔县| 庆安县| 祁东县| 阿图什市| 辉南县| 洛宁县| 沾益县| 肥乡县| 青浦区| 潢川县| 江阴市| 于田县| 嘉义市| 石嘴山市| 石渠县| 东丽区| 隆尧县| 温宿县| 扎囊县| 离岛区| 湘乡市| 汶上县| 葫芦岛市| 东台市| 务川|