What's New in ASP.NET Core 3 Preview 6


ASP.NET Core 3.0 ASP.NET Core 3 seems to be taking a similar tact to version 1 as it is adding a lot of functionality and phasing it in with different previews. While a lot of the articles seem to be focusing on the non-ASP.NET features (e.g. WPF, WinForms, etc.), I thought it would be nice to let those of you who are ASP.NET devs know what is in Preview 6 just for you.

It feels a lot like the ASP.NET MVC/API side is being treated as mature and stable as there is are not a lot of surface changes. Microsoft does seem to be doubling down on Razor Pages and Blazor. It feels like they want .NET Core to be a good fit for different styles and backgrounds of developer. This release is no different.

Let's take a look at the details:

Blazor

  • @attribute: Let's you add attributes usage in your Razor files (more common in .razor components than in .cshtml files)
  • @code: Equivalent to @functions feature. Only supported in .razor file components. Used to add code blocks.
  • @key: Used to help Blazor optimize handling lists of components so that it knows a key to know what to replace or where to insert new objects in a Blazor view.
  • Blazor attributes have been standardized to a format of @directive(-suffix(:name))(=value)
  • Blazor templates now support Authentication and Authorization

JSON Support

By default, all ASP.NET Core projects will use System.Text.Json by default. You can still opt into JSON.NET by using:

  services.AddMvc()
    .AddNewtonsoftJson();

Security Changes

Preview 6 now supports Certificate and Kerberos authentiation and authorization. For example:

    services.AddAuthentication(
        CertificateAuthenticationDefaults.AuthenticationScheme)
            .AddCertificate();

This opens ASP.NET Core to more security requirements. I'm excited to see this.

SignalR

By opting into the new client-side @aspnet/signalr@next you'll be able to add auto reconnection via opting into it in your SignalR projects:

const connection = new signalR.HubConnectionBuilder()
    .withUrl("/chatHub")
    .withAutomaticReconnect()
    .build();

This will reconnect at 2, 10 and 30 second intervals. You can customize these timings too.

gRPC

gRPC now has a completely managed client. So if you're building .NET end-to-end via a gRPC endpoint, you can now do this much easier with both a managed client and a client factory. I see gRPC as a good replacement for WCF's non-http services. If you haven't looked at gRPC yet, it's an interesting technology if you're not expecting a variety of clients. SignalR is built via gRPC under the covers. And yes, gRPC is an open spec, not a Microsoft invention. See an overview at https://grpc.io/docs/guides/.



Shawn
Shawn Wildermuth
Author, Teacher, and Coach




My Courses

Wilder Minds Training
Vue.js by Example (New Lower Price)
Bootstrap 4 by Example (New Lower Price)
Intro to Font Awesome 5 (Free Course)
Pluralsight
Building an API with ASP.NET Core (New Course)
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.2)
Less: Getting Started (New)
Using Visual Studio Code for ASP.NET Core Projects
Implementing ASP.NET Web API

Application Name WilderBlog Environment Name Production
Application Ver v4.0.30319 Runtime Framework x86
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.27617.04
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86