Sick Gaming
ASP.NET Core 2.2.0-preview2 now available - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Programming (https://www.sickgaming.net/forum-76.html)
+--- Forum: C#, Visual Basic, & .Net Frameworks (https://www.sickgaming.net/forum-79.html)
+--- Thread: ASP.NET Core 2.2.0-preview2 now available (/thread-86440.html)



ASP.NET Core 2.2.0-preview2 now available - xSicKxBot - 09-13-2018

ASP.NET Core 2.2.0-preview2 now available

<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/09/asp-net-core-2-2-0-preview2-now-available.png" width="646" height="424" title="" alt="" /></div><div><p>Today we’re very happy to announce that the second 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 over the past months, 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="how-do-i-get-it">How do I get it?</h2>
<p>You can download the new .NET Core SDK for 2.2.0-preview2 (which includes ASP.NET 2.2.0-preview2) 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="visual-studio-requirements">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 2) 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="azure-app-service-requirements">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-preview2 applications.</p>
<h2 id="impact-to-machines">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="whats-new-in-preview-2">What’s new in Preview 2</h2>
<p>For a full list of changes, bug fixes, and known issues you can read the <a href="https://github.com/aspnet/Home/releases/tag/2.2.0-preview2">release notes</a>.</p>
<h3 id="signalr-java-client-updated-to-support-azure-signalr-service">SignalR Java Client updated to support Azure SignalR Service</h3>
<p>The SignalR Java Client, first introduced in preview 1, now has support for the Azure SignalR Service. You can now develop Java and Android applications that connect to a SignalR server using the Azure SignalR Service. To get this new functionality, just update your Maven or Gradle file to reference version 0.1.0-preview2-35174 of the SignalR Client package.</p>
<h3 id="problem-details-support">Problem Details support</h3>
<p>In 2.1.0, MVC introduced <code>ProblemDetails</code>, based on the <a href="https://tools.ietf.org/html/rfc7807">RFC 7807 specification</a> for carrying detils of an error with a HTTP Response. In preview2, we’re standardizing around using <code>ProblemDetails</code> for client error codes in controllers attributed with <code>ApiControllerAttribute</code>. An <code>IActionResult</code> returning a client error status code (4xx) will now return a <code>ProblemDetails</code> body. The result additionally includes a correlation ID that can be used to correlate the error using request logs. Lastly, <code>ProducesResponseType</code> for client errors, default to using <code>ProblemDetails</code> as the response type. This will be documented in Open API / Swagger output generated using <a href="https://aka.ms/openapi-aspnetcore">NSwag or Swashbuckle.AspNetCore</a>. Documentation for configuring the <code>ProblemDetails</code> response can be found here – <a href="https://aka.ms/AA2k4zg">https://aka.ms/AA2k4zg</a>.</p>
<h3 id="asp.net-core-module-improvements">ASP.NET Core Module Improvements</h3>
<p>We’ve introduced a new module (<code>aspNetCoreModuleV2</code>) for hosting ASP.NET Core application in IIS in 2.2.0-preview1. This new module adds the ability to host your .NET Core application within the IIS worker process and avoids the additional cost of reverse-proxying your requests over to a separate dotnet process.</p>
<figure><a href="http://www.sickgaming.net/blog/wp-content/uploads/2018/09/asp-net-core-2-2-0-preview2-now-available.png"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/09/asp-net-core-2-2-0-preview2-now-available.png" alt="" width="646" height="424" class="alignnone size-full wp-image-15115" /></a></figure>
<p>ASP.NET Core 2.2.0-preview2 or newer projects default to the new in-process hosting model. If you are upgrading from preview1, you will need to add a new project property to your <code>.csproj</code> file.</p>
<div class="sourceCode" id="cb1">
<pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;PropertyGroup&gt;</span> <span class="kw">&lt;TargetFramework&gt;</span>netcoreapp2.2<span class="kw">&lt;/TargetFramework&gt;</span> <span class="kw">&lt;AspNetCoreHostingModel&gt;</span>inprocess<span class="kw">&lt;/AspNetCoreHostingModel&gt;</span>
<span class="kw">&lt;/PropertyGroup&gt;</span></code></pre>
</div>
<p>Visual Studio 15.9-preview2 adds the ability to switch your hosting model as part of your development-time experience.</p>
<figure><a href="http://www.sickgaming.net/blog/wp-content/uploads/2018/09/asp-net-core-2-2-0-preview2-now-available-1.png"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/09/asp-net-core-2-2-0-preview2-now-available-1.png" alt="" width="877" height="736" class="alignnone size-full wp-image-15125" /></a></figure>
<h4 id="hosting-in-iis">Hosting in IIS</h4>
<p>To deploy applications targeting ASP.NET Core 2.2.0-preview2 on servers with IIS, you require a new version of the 2.2 Runtime &amp; Hosting Bundle on the target server. The bundle is available at <a href="https://www.microsoft.com/net/download/dotnet-core/2.2">https://www.microsoft.com/net/download/dotnet-core/2.2</a>.</p>
<h4 id="caveats">Caveats</h4>
<p>There are a couple of caveats with the new in-process hosting model: – You are limited to one application per IIS Application Pool. – No support for .NET Framework. The new module is only capable of hosting .NET Core in the IIS process.</p>
<p>If you have a ASP.NET Core 2.2 app that’s using the in process hosting model, you can turn it off by setting the <code>&lt;AspNetCoreHostingModel&gt;</code> element to <code>outofprocess</code> in your <code>.csproj</code> file.</p>
<h3 id="template-updates">Template Updates</h3>
<p>We’ve cleaned up the Bootstrap 4 project template work that we started in Preview 1. We’ve also added support to the default Identity UI for using both Bootstrap 3 &amp; 4. For compatibility with existing apps the default Bootstrap version for the default UI is now Bootstrap 3, but you can select which version of Boostrap you want to use when calling <code>AddDefaultUI</code>.</p>
<h3 id="healthcheck-improvements">HealthCheck Improvements</h3>
<p>There are a few small, but important, changes to health checks in preview2.</p>
<p>You can now call <code>AddCheck&lt;T&gt;</code> where <code>T</code> is a type of <code>IHealthCheck</code>:</p>
<div class="sourceCode" id="cb1">
<pre class="sourceCode csharp"><code class="sourceCode cs">services.<span class="fu">AddHealthChecks</span>() .<span class="fu">AddCheck</span>&lt;MyHealthCheck&gt;();</code></pre>
</div>
<p>This will register your health check as a transient service, meaning that each time the health check service is called a new instance will be created. We allow you to register <code>IHealthCheck</code> implementations with any service lifetime when you register them manually:</p>
<div class="sourceCode" id="cb2">
<pre class="sourceCode csharp"><code class="sourceCode cs">services.<span class="fu">AddHealthChecks</span>();
services.<span class="fu">AddSingleton</span>&lt;IHealthCheck, MySingletonCheck&gt;();</code></pre>
</div>
<p>A scope is created for each invocation of the <code>HealthChecksService</code>. As with all DI lifetimes you should be careful when creating singleton objects that depend on services with other lifetimes as described <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection">here</a>.</p>
<p>You can filter which checks you want to execute when using the middleware or the <code>HealthCheckService</code> directly. In this example we are executing all our health checks when a request is made on the <code>ready</code> path, but just returning a <code>200 OK</code> when the <code>live</code> path is hit:</p>
<div class="sourceCode" id="cb3">
<pre class="sourceCode csharp"><code class="sourceCode cs"><span class="co">// The readiness check uses all of the registered health checks (default)</span>
app.<span class="fu">UseHealthChecks</span>(<span class="st">"/health/ready"</span>);

<span class="co">// The liveness check uses an 'identity' health check that always returns healthy</span>
app.<span class="fu">UseHealthChecks</span>(<span class="st">"/health/live"</span>, <span class="kw">new</span> <span class="fu">HealthCheckOptions</span>()
{ <span class="co">// Exclude all checks, just return a 200.</span> Predicate = (check) =&gt; <span class="kw">false</span>,
});</code></pre>
</div>
<p>You might do this if, for example, you are using Kubernetes and want to run a comprehensive set of checks before traffic is sent to your application but otherwise are OK as long as you are reachable and still running.</p>
<h4 id="whats-still-to-come">What’s still to come?</h4>
<p>We are investaging adding a tags mechanism to checks, so that they can be set and filtered on. We also want to provide an Entity Framework specific check that will check whatever database has been configured to be used with your <code>DbContext</code>.</p>
<h2 id="migrating-an-asp.net-core-2.1-project-to-2.2">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-preview2, 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="giving-feedback">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 https://github.com/aspnet or https://github.com/dotnet. We look forward to receiving your feedback!</p>
<p> </p>
</div>