Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASP.NET Core 2.2.0-preview3 now available

#1
ASP.NET Core 2.2.0-preview3 now available

<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/asp-net-core-2-2-0-preview3-now-available.png" width="624" height="401" title="" alt="" /></div><div><p>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.</p>
<h2 id="howdoigetit">How do I get it?</h2>
<p>You can download the new .NET Core SDK for 2.2.0-preview3 (which includes ASP.NET 2.2.0-preview3) from <a href="https://www.microsoft.com/net/download/dotnet-core/2.2">https://www.microsoft.com/net/download/dotnet-core/2.2</a></p>
<h2 id="visualstudiorequirements">Visual Studio requirements</h2>
<p>Customers using Visual Studio should also install and use the <a href="https://www.visualstudio.com/vs/preview/">Preview channel</a> 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.</p>
<h2 id="azureappservicerequirements">Azure App Service Requirements</h2>
<p>If you are hosting your application on Azure App Service, you can follow <a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/azure-apps/?view=aspnetcore-2.1#install-the-preview-site-extension">these instructions</a> to install the required site extension for hosting your 2.2.0-preview3 applications.</p>
<h2 id="impacttomachines">Impact to machines</h2>
<p>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.json</code> file as <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/global-json">documented here</a>. Please <a href="https://github.com/dotnet/cli/issues">log an issue</a> if you run into such cases as SDK releases are intended to be backwards compatible.</p>
<h2 id="whatsnewinpreview3">What’s new in Preview 3</h2>
<p>For a full list of changes, bug fixes, and known issues you can read the <a href="https://github.com/aspnet/Announcements/issues/323">release announcement</a>.</p>
<h3 id="routing">Routing</h3>
<p>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>slugify</code> parameter transformer in route pattern <code>blog\{article:slugify}</code> with <code>Url.Action(new { article = "MyTestArticle" })</code> generates <code>blog\my-test-article</code>. Parameter transformers implement <code>Microsoft.AspNetCore.Routing.IOutboundParameterTransformer</code> and are configured using <a href="https://docs.microsoft.com/dotnet/api/microsoft.aspnetcore.routing.routeoptions.constraintmap#Microsoft_AspNetCore_Routing_RouteOptions_ConstraintMap">ConstraintMap</a>.</p>
<p>These features are specific to the new endpoint routing system used in MVC by default in 2.2.</p>
<p>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>area</code>, <code>controller</code>, <code>action</code>, and <code>page</code>.</p>
<pre><code class="csharp language-csharp">routes.MapRoute( name: "default", template: "{controller=Home:slugify}/{action=Index:slugify}/{id?}");
</code></pre>
<p>With the preceding route, the action <code>SubscriptionManagementController.GetAll()</code> is matched with the URI <code>/subscription-management/get-all</code>. A parameter transformer doesn’t change the route values used to generate a link. <code>Url.Action("GetAll", "SubscriptionManagement")</code> outputs <code>/subscription-management/get-all</code>.</p>
<p>ASP.NET Core provides API conventions for using a parameter transformers with generated routes:</p>
<ul>
<li>MVC has the <code>Microsoft.AspNetCore.Mvc.ApplicationModels.RouteTokenTransformerConvention</code> API convention. This convention applies a specified parameter transformer to all attribute routes in the app. The parameter transformer will transform attribute route tokens as they are replaced. For more information, see <a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/routing?view=aspnetcore-2.2#use-a-parameter-transformer-to-customize-token-replacement">Use a parameter transformer to customize token replacement</a>.</li>
<li>Razor pages has the <code>Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteTransformerConvention</code> API convention. This convention applies a specified parameter transformer to all automatically discovered Razor pages. The parameter transformer will transform the folder and file name segments of Razor page routes. For more information, see <a href="https://docs.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2#use-a-parameter-transformer-to-customize-page-routes">Use a parameter transformer to customize page routes</a>.</li>
</ul>
<h3 id="linkgeneration">Link Generation</h3>
<p>Added a new service called <code>LinkGenerator</code>, it is a singleton service that supports generating paths and absolute URIs both with and without an <code>HttpContext</code>. If you need to generate links in Middleware or somewhere outside of Razor then this new service will be useful to you. You can use it in Razor, but the existing APIs like <code>Url.Action</code> are already backed by the new service so you can continue to use those.</p>
<pre><code class="csharp language-csharp">return _linkGenerator.GetPathByAction( httpContext, controller: "Home", action: "Index", values: new { id=42 });
</code></pre>
<p>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.</p>
<h3 id="healthchecks">Health Checks</h3>
<h4 id="dbcontexthealthcheck">DbContextHealthCheck</h4>
<p>We added a new <code>DbContext</code> based check for when you are using Entity Framework Core:</p>
<pre><code class="csharp language-csharp">// 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&lt;MyContext&gt;();
</code></pre>
<p>This check will make sure that the application can communicate with the database you configured for <code>MyContext</code>. By default the <code>DbContextHealthCheck</code> will call the <code>CanConnectAsync</code> method that is being added to Entity Framework Core 2.2. You can customize what operation is run when checking health using overloads of the <code>AddDbContextCheck</code> method.</p>
<h4 id="healthcheckpublisher">Health Check Publisher</h4>
<p>We added the <code>IHealthCheckPublisher</code> interface that has a single method you can implement:</p>
<pre><code class="csharp language-csharp">Task PublishAsync(HealthReport report, CancellationToken cancellationToken);
</code></pre>
<p>If you add an <code>IHealthCheckPublisher</code> to DI then the health checks system will periodically execute your health checks and call <code>PublishAsync</code> with the result. We expect this to be useful when you are interacting with a push based health system that expects each process to call it periodically in order to determine health.</p>
<h4 id="tags">Tags</h4>
<p>In preview3 we added the ability to tag health checks with a list of strings when you register them:</p>
<pre><code class="csharp language-csharp">services.AddHealthChecks() .AddDbContextCheck&lt;MyContext&gt;(tags: new[] { "db" });
</code></pre>
<p>Once you’ve done this then you can filter execution of your checks via tag:</p>
<pre><code class="csharp language-csharp">app.UseHealthChecks("/liveness", new HealthCheckOptions
{ Predicate = (_) =&gt; false
});

app.UseHealthChecks("/readiness", new HealthCheckOptions
{ Predicate = (check) =&gt; check.Tags.Contains("db")
});
</code></pre>
<p>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.</p>
<p>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>Degraded</code> rather than <code>UnHealthy</code>.</p>
<h3 id="validationperformanceimprovements">Validation Performance Improvements</h3>
<p>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>, <code>[StringLength]</code> etc, or <code>IValidatableObject</code>) and don’t require this extra flexability.</p>
<p>In 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>, <code>string[]</code>, <code>Dictionary&lt;string, string&gt;</code> etc), or complex object graphs without many validators.</p>
<p>For this model – <a href="https://github.com/aspnet/Mvc/blob/release/2.2/benchmarkapps/BasicApi/Models/Pet.cs">https://github.com/aspnet/Mvc/blob/release/2.2/benchmarkapps/BasicApi/Models/Pet.cs</a> – the table below compares the difference in Requests Per Second (RPS) with and without the enhancement:</p>
<table>
<thead>
<tr>
<th>Description</th>
<th>RPS</th>
<th>Memory (MB)</th>
<th>Avg. Latency (ms)</th>
<th>Startup (ms)</th>
<th>First Request (ms)</th>
<th>Ratio</th>
</tr>
</thead>
<tbody>
<tr>
<td>Baseline</td>
<td>78,738</td>
<td>398</td>
<td>3.5</td>
<td>547</td>
<td>111.3</td>
<td>1.00</td>
</tr>
<tr>
<td>Validation changes</td>
<td>90,167</td>
<td>401</td>
<td>2.9</td>
<td>541</td>
<td>115.9</td>
<td>1.15</td>
</tr>
</tbody>
</table>
<h3 id="httpclientperformanceimprovements">HTTP Client Performance Improvements</h3>
<p>Some significant performance improvements have been made to <a href="https://github.com/dotnet/corefx/tree/master/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler">SocketsHttpHandler</a> 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 <a href="https://github.com/dotnet/corefx/pull/32568">Github #32568</a> for the actual code change that made this improvement.</p>
<p>Requests Per Second Linux (higher is better)</p>
<p><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/asp-net-core-2-2-0-preview3-now-available.png" alt="image" /></p>
<p>Requests Per Second Windows (higher is better)</p>
<p><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/asp-net-core-2-2-0-preview3-now-available-1.png" alt="image" /></p>
<p>Request Latency Linux (lower is better)</p>
<p><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/asp-net-core-2-2-0-preview3-now-available-2.png" alt="image" /></p>
<p>Request Latency Windows (lower is better)</p>
<p><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/asp-net-core-2-2-0-preview3-now-available-3.png" alt="image" /></p>
<h3 id="aspnetcoremodule">ASP.NET Core Module</h3>
<p>We added support for the ability to detect client disconnects when you’re using the new IIS in-process hosting model. The <code>HttpContext.RequestAborted</code> cancellation token now gets tripped when your client disconnnects.</p>
<p>The 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.</p>
<pre><code class="xml language-xml">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration&gt; &lt;location path="." inheritInChildApplications="false"&gt; &lt;system.webServer&gt; &lt;handlers&gt; &lt;add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /&gt; &lt;/handlers&gt; &lt;aspNetCore processPath="dotnet" arguments=".\clientdisconnect.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"&gt; &lt;handlerSettings&gt; &lt;handlerSetting name="debugFile" value="debug.txt" /&gt; &lt;handlerSetting name="debugLevel" value="TRACE" /&gt; &lt;/handlerSettings&gt; &lt;/aspNetCore&gt; &lt;/system.webServer&gt; &lt;/location&gt;
&lt;/configuration&gt;
</code></pre>
<h3 id="signalrjavaclient">SignalR Java Client</h3>
<p>Preview 3 includes a few notable changes to the SignalR Java Client as we progress towards a 1.0 release:</p>
<p>The “groupId” for the Maven package has changed to <code>com.microsoft.signalr</code>. To reference the new package from a Maven POM file, add the following dependency:</p>
<pre><code class="xml language-xml">&lt;dependency&gt; &lt;groupId&gt;com.microsoft.signalr&lt;/groupId&gt; &lt;artifactId&gt;signalr&lt;/artifactId&gt; &lt;version&gt;1.0.0-preview3-35501&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<p>Or in Gradle:</p>
<pre><code class="gradle language-gradle">implementation 'com.microsoft.signalr:signalr:1.0.0-preview3-35501'
</code></pre>
<p>In Preview 3 we’ve changed all the APIs to be asynchronous, using <a href="https://github.com/ReactiveX/RxJava">RxJava</a>. Our <a href="https://docs.microsoft.com/en-us/aspnet/core/signalr/java-client?view=aspnetcore-2.2">Java Client documentation</a> will be updated to show the new usage patterns. We also have support for the <code>invoke</code> method, allowing the client code to wait for the server method to complete. This version also includes support for serializing custom types in method arguments and return values.</p>
<p>The Java Client currently requires <strong>Android API Level 26</strong> (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 <a href="https://github.com/aspnet/SignalR/issues/3143">the GitHub issue tracking our Android API level support</a> so we know what API level would work well for our users.</p>
<h2 id="migratinganaspnetcore21projectto22">Migrating an ASP.NET Core 2.1 project to 2.2</h2>
<p>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.</p>
<h2 id="givingfeedback">Giving Feedback</h2>
<p>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 <a href="https://github.com/aspnet">https://github.com/aspnet</a> or <a href="https://github.com/dotnet">https://github.com/dotnet</a>. We look forward to receiving your feedback!</p>
<p> </p>
</div>
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016