![]() |
|
ASP.NET Core 2.2.0-preview3 now available - Printable Version +- Sick Gaming (https://sickgaming.net) +-- Forum: Programming (https://sickgaming.net/forum-76.html) +--- Forum: C#, Visual Basic & .NET (https://sickgaming.net/forum-79.html) +--- Thread: ASP.NET Core 2.2.0-preview3 now available (/thread-86930.html) |
ASP.NET Core 2.2.0-preview3 now available - xSicKxBot - 10-18-2018 ASP.NET Core 2.2.0-preview3 now available Today we’re very happy to announce that the third preview of the next minor release of ASP.NET Core and .NET Core is now available for you to try out. We’ve been working hard on this release, along with many folks from the community, and it’s now ready for a wider audience to try it out and provide the feedback that will continue to shape the release. How do I get it? You can download the new .NET Core SDK for 2.2.0-preview3 (which includes ASP.NET 2.2.0-preview3) from https://www.microsoft.com/net/download/dotnet-core/2.2 Visual Studio requirements Customers using Visual Studio should also install and use the Preview channel of Visual Studio 2017 (15.9 Preview 3 or later) in addition to the SDK when working with .NET Core 2.2 and ASP.NET Core 2.2 projects. Please note that the Visual Studio preview channel can be installed side-by-side with existing an Visual Studio installation without disrupting your current development environment. Azure App Service Requirements If you are hosting your application on Azure App Service, you can follow these instructions to install the required site extension for hosting your 2.2.0-preview3 applications. Impact to machines Please note that is a preview release and there are likely to be known issues and as-yet-to-be discovered bugs. While the .NET Core SDK and runtime installs are side-by-side, your default SDK will become the latest one. If you run into issues working on existing projects using earlier versions of .NET Core after installing the preview SDK, you can force specific projects to use an earlier installed version of the SDK using a Code: global.jsonWhat’s new in Preview 3 For a full list of changes, bug fixes, and known issues you can read the release announcement. Routing We’ve introduced the concept of Parameter Transformers to routing in ASP.NET Core 2.2. A parameter transformer customizes the route generated by transforming parameter’s route values, and gives developers new options when generating routes. For example, a custom Code: slugifyCode: blog\{article:slugify}Code: Url.Action(new { article = "MyTestArticle" })Code: blog\my-test-articleCode: Microsoft.AspNetCore.Routing.IOutboundParameterTransformerThese features are specific to the new endpoint routing system used in MVC by default in 2.2. Parameter transformers are also used by frameworks to transform the URI to which an endpoint resolves. For example, ASP.NET Core MVC uses parameter transformers to transform the route value used to match an Code: areaCode: controllerCode: actionCode: pageCode: routes.MapRoute( name: "default", template: "{controller=Home:slugify}/{action=Index:slugify}/{id?}");With the preceding route, the action Code: SubscriptionManagementController.GetAll()Code: /subscription-management/get-allCode: Url.Action("GetAll", "SubscriptionManagement")Code: /subscription-management/get-allASP.NET Core provides API conventions for using a parameter transformers with generated routes:
Link Generation Added a new service called Code: LinkGeneratorCode: HttpContextCode: Url.ActionCode: return _linkGenerator.GetPathByAction( httpContext, controller: "Home", action: "Index", values: new { id=42 });For now this is useful to link to MVC actions and pages from outside of MVC. We will add additional features in the next release targeting non-MVC scenarios. Health Checks DbContextHealthCheck We added a new Code: DbContextCode: // Registers required services for health checks
services.AddHealthChecks() // Registers a health check for the MyContext type. By default the name of the health check will be the // name of the DbContext type. There are other options available through AddDbContextCheck to configure // failure status, tags, and custom test query. .AddDbContextCheck<MyContext>();This check will make sure that the application can communicate with the database you configured for Code: MyContextCode: DbContextHealthCheckCode: CanConnectAsyncCode: AddDbContextCheckHealth Check Publisher We added the Code: IHealthCheckPublisherCode: Task PublishAsync(HealthReport report, CancellationToken cancellationToken);If you add an Code: IHealthCheckPublisherCode: PublishAsyncTags In preview3 we added the ability to tag health checks with a list of strings when you register them: Code: services.AddHealthChecks() .AddDbContextCheck<MyContext>(tags: new[] { "db" });Once you’ve done this then you can filter execution of your checks via tag: Code: app.UseHealthChecks("/liveness", new HealthCheckOptions
{ Predicate = (_) => false
});
app.UseHealthChecks("/readiness", new HealthCheckOptions
{ Predicate = (check) => check.Tags.Contains("db")
});We see tags as a way for consumers of health checks, application authors, to use as a convenient grouping and filtering mechanism for their health checks. Not something that health check authors will pre-populate. You can also customize what status a failure of this check means for your application, for example if your application is written such that it can handle the database not being available then a database being down might mean Code: DegradedCode: UnHealthyValidation Performance Improvements MVC’s validation system is designed to be extensible and flexible allowing developer to determine on a per request basis what validators apply to a given model. This is great for authoring complex validation providers. However, in the most common case your application only uses the built-in validation pieces such as DataAnnotations ( Code: [Required]Code: [StringLength]Code: IValidatableObjectIn 2.2.0-preview3, we’re adding a feature that allows MVC to short-circuit validation if it can determine that a given model graph would not require any validation. This results in significant improvements when validating models that cannot or do not have any associated validators. This includes objects such as collections of primitives ( Code: byte[]Code: string[]Code: Dictionary<string, string>For this model – https://github.com/aspnet/Mvc/blob/release/2.2/benchmarkapps/BasicApi/Models/Pet.cs – the table below compares the difference in Requests Per Second (RPS) with and without the enhancement: Description | RPS | Memory (MB) | Avg. Latency (ms) | Startup (ms) | First Request (ms) | Ratio Baseline | 78,738 | 398 | 3.5 | 547 | 111.3 | 1.00 Validation changes | 90,167 | 401 | 2.9 | 541 | 115.9 | 1.15 HTTP Client Performance Improvements Some significant performance improvements have been made to SocketsHttpHandler by improving the connection pool locking contention. For applications making many outgoing HTTP requests, such as some Microservices architectures, throughput should be significantly improved. Our internal benchmarks show that under load HttpClient throughput has improved by 60% on Linux and 20% on Windows. At the same time the 90th percentile latency was cut down by two on Linux. See Github #32568 for the actual code change that made this improvement. Requests Per Second Linux (higher is better) Requests Per Second Windows (higher is better) Request Latency Linux (lower is better) Request Latency Windows (lower is better) ASP.NET Core Module We added support for the ability to detect client disconnects when you’re using the new IIS in-process hosting model. The Code: HttpContext.RequestAbortedThe ASP.NET Core Module also features enhanced diagnostics logs that configurable via the new handler settings or environment variables that expose a higher fidelity of diagnostic information. Code: <?xml version="1.0" encoding="utf-8"?>
<configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="dotnet" arguments=".\clientdisconnect.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"> <handlerSettings> <handlerSetting name="debugFile" value="debug.txt" /> <handlerSetting name="debugLevel" value="TRACE" /> </handlerSettings> </aspNetCore> </system.webServer> </location>
</configuration>Preview 3 includes a few notable changes to the SignalR Java Client as we progress towards a 1.0 release: The “groupId” for the Maven package has changed to Code: com.microsoft.signalrCode: <dependency> <groupId>com.microsoft.signalr</groupId> <artifactId>signalr</artifactId> <version>1.0.0-preview3-35501</version>
</dependency>Or in Gradle: Code: implementation 'com.microsoft.signalr:signalr:1.0.0-preview3-35501'In Preview 3 we’ve changed all the APIs to be asynchronous, using RxJava. Our Java Client documentation will be updated to show the new usage patterns. We also have support for the Code: invokeThe Java Client currently requires Android API Level 26 (or higher). We are investigating moving down to a lower API level before RTM. If you are planning to use SignalR in an Java-based Android application, please comment on the GitHub issue tracking our Android API level support so we know what API level would work well for our users. Migrating an ASP.NET Core 2.1 project to 2.2 To migrate an ASP.NET Core project from 2.1.x to 2.2.0-preview3, open the project’s .csproj file and change the value of the the element to netcoreapp2.2. You do not need to do this if you’re targeting .NET Framework 4.x. Giving Feedback The main purpose of providing previews is to solicit feedback so we can refine and improve the product in time for the final release. Please help provide us feedback by logging issues in the appropriate repository at https://github.com/aspnet or https://github.com/dotnet. We look forward to receiving your feedback! |