Announcing ASP.NET Core 2.0.0-Preview1 and Updates for .NET Web Developers


The ASP.NET team is pleased to share the first preview version of the ASP.NET Core 2.0 framework.  In this post, we’ll look at the new features and changes to the web framework that were announced at the Build 2017 keynote and sessions.  We will also look at some other updates that were published for ASP.NET 4.7 and WCF.

 

ASP.NET Core 2.0.0-preview1

The next full version of ASP.NET Core is on its way, and developers who have been following along on the ASP.NET GitHub repositories have been very vocal about their interest in the new features in this version.  Some of these new features include:

  • A new ASP.NET Core meta-package that includes all features that you need to build an application. No longer do you need to pick and choose individual ASP.NET Core features in separate packages as all features are now included in a Microsoft.AspNetCore.All package in the default templates. If there are features you don’t need in your application, our new package trimming features will exclude those binaries in your published application output by default.
  • A new default Web Host configuration, codifying the typical defaults of the web host with the WebHost.CreateDefaultBuilder() API. This adds Kestrel, IIS configuration, default configuration sources, logging providers, and the content root.
  • Updated configuration and simplified logging. We have enhanced the LoggerFactory object to easily support a Dictionary<string, LogLevel> that defines log filters instead of a FilterLoggerSettings object, making it simpler to control the source and level of logs that get propagated from your application to your configured log providers.
  • Create pages without controllers in ASP.NET Core with the new RazorPages capabilities.  Just create a Pages folder and drop in a cshtml file with the new @page directive to get started.
  • Debugging your application in the cloud is easier than ever with integrated Azure Application Insights and diagnostics when debugging in Visual Studio and after deploying to Azure App Service.
  • A newly revamped authentication model that makes it easy to configure authentication for your application using DI.
  • New templates for configuring authentication for your web apps and web APIs using Azure AD B2C
  • New support in ASP.NET Core Identity for providing identity as a service. Updated templates decouple your apps from their identity concerns standard protocols (OpenID Connect, OAuth 2.0). Easily migrate apps using ASP.NET Core Identity for authentication to use Azure AD B2C or any other OpenID Connect compliant identity provider.
  • Build secure web APIs using ASP.NET Core Identity. Acquire access tokens for accessing your web APIs using the Microsoft Authentication Library (MSAL)
  • NET Core has always helped HTMLEncode your content by default, but with the new version we’re taking an extra step to help prevent cross-site request forgery (XSRF) attacks: ASP.NET Core will now emit anti-forgery tokens by default and validate them on form POST actions and pages without extra configuration.

For a full list of changes see the release notes.

ASP.NET Core 2 – More Performance Improvements

ASP.NET Core 1 was ranked in the top 10 of the TechEmpower plaintext benchmarks in November 2016.  We’ve continued to work on our performance, and we’re already seeing improvements thanks to enhancements in the Kestrel server, thread pool, and JITter, to name just a few.

We are also providing a runtime store with pre-JITted versions of all of the ASP.NET Core packages we ship.  This reduces a lot of the work needed at startup time for your application.  Our initial tests reflect a significant improvement in startup time and we’re continuing to work on optimizing the store for subsequent releases.

 

ASP.NET 4.7 – SQL Server, Session Provider, and OutputCache Provider

We’re also announcing an update to the SQL Server session provider and Session State module this week for ASP.NET 4.7  This provider contains updates that will help you with modern web applications.  We see customers with JavaScript that makes multiple concurrent requests to the server for data.  These requests, by default, lock the session object and prevent concurrent requests.  The new Session State provider eliminates that concurrency locking check, and also allows you to configure throttling for concurrent requests for the same session ID.  The updated session state module ships with an updated In-Memory provider, the default provider with ASP.NET

The SQL Server provider has been optimized for SQL Server versions 2008 and later, as well as for Azure SQL Server.  All requests to the database are asynchronous and should help with concurrent request performance on your web applications.  It has also been configured to no longer require you to allocate the tables and schema for the session management, and instead create and manage them for you.  The database provider also works with the new concurrent requests mode.  Finally, the provider has been optimized to use in-memory OLTP on SQL Server 2016 and SQL Azure.

Activate the updated Session Provider’s concurrent requests per session feature with the following AppSettings:

The SQL Server OutputCache provider has been updated and now utilize asynchronous IO as well.  You can reference the updated provider with this markup in your web.config:

We expect to release these packages next week.  You will be able to install the providers for ASP.NET 4.7 from NuGet:

  • Install-Package Microsoft.AspNet.OutputCache.OutputCacheModuleAsync
  • Install-Package Microsoft.AspNet.OutputCache.SQLAsyncOutputCacheProvider
  • Install-Package Microsoft.AspNet.SessionState.SessionStateModule
  • Install-Package Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync

We’ll post an update when they are available.

WCF Connected Services and Containers

The WCF team has issued an update to the WCF Connected Service extension for Visual Studio 2017 and .NET Core.  This extension provides the same “Add Connected Service” feature that you’re familiar with in .NET Framework.  The tool makes it much simpler to configure.NET Core 1.x projects that need to connect to WCF end points.  A future update will enable connectivity from .NET Core 2.0 projects. Install the extension for Visual Studio 2017 from the Visual Studio Marketplace.

Connected WCF Service Extension

Last week we quietly published a WCF Docker image to assist in shifting HTTP services to Docker Windows containers.  This initial container supports HTTP services running on .NET 4.6.1 in self-hosted or IIS-hosted models and does not have tooling available to support it just yet.  You can migrate your service to a container by adding a Dockerfile to a project with a self-hosted or IIS-hosted service that contains the following configuration:

More details and samples with this image can be found on the WCF docker image repository.  Details are also available if you would like to run the WCF client for .NET Core in a container.

Are you interested in working with other endpoints or security with WCF services in containers?  Let us know what features you want to see in our next set of updates for WCF container images in the comments area below.

Preview 1 Issues

This preview version of ASP.NET Core 2.0 ships with support for the .NET Core 2.0 SDK only.  Our goal is to ship ASP.NET Core 2.0 on .NET Standard 2.0 so applications can run on .NET Core, Mono and .NET Framework.  As the team was working through the last of their issues before Build, it was uncovered that the preview of ASP.NET Core 2.0 utilized API’s that were outside of .NET Standard 2.0, preventing it from running on .NET Framework. Because of this we limited Preview 1 support .NET Core only so it would not break a developer upgrading an ASP.NET Core 1.x application to ASP.NET Core 2 preview on .NET Framework.

Summary

The .NET teams have been very busy, and brought a bunch of updates to Build for all of our web frameworks.  After the conference completes. We’ll publish another post with links to videos from our sessions about all of these features and samples.  You can watch some of our sessions online at Channel 9 and you can download the ASP.NET Core 2 Preview 1 release from http://dot.net

 

source