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 Core projects now default to pre-compiling Razor views and pages during publish, which removes one of the most significant portions of application startup time after deployment. This change, along with the aforementioned publish trimming and runtime store, also contributes to the drastic reduction in size of published applications, reducing deployment times and disk usage on servers.
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:
<add key="aspnet:AllowConcurrentRequestsPerSession" value="true" /> <add key="aspnet:RequestQueueLimitPerSession" value="100" />
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:
<caching> <outputCache defaultProvider="SQLAsyncOutputCacheProvider"> <providers> <add name="SQLAsyncOutputCacheProvider" connectionStringName="DefaultConnection1" type="Microsoft.AspNet.OutputCache.SQLAsyncOutputCacheProvider.SQLAsyncOutputCacheProvider, Microsoft.AspNet.OutputCache.SQLAsyncOutputCacheProvider" /> </providers> </outputCache> </caching> <modules> <remove name="OutputCache" /> <add name="OutputCache" type="Microsoft.AspNet.OutputCache.OutputCacheModuleAsync, Microsoft.AspNet.OutputCache.OutputCacheModuleAsync" preCondition="integratedMode" /> </modules>
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.
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:
FROM microsoft/wcf RUN mkdir C:\WcfService RUN powershell -NoProfile -Command \ Import-module IISAdministration; \ New-IISSite -Name "WcfService" -PhysicalPath C:\WcfService -BindingInformation "*:83:" EXPOSE 83 ADD content/ /WcfService
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
Link to Razor Pages is broken. Please update to https://docs.microsoft.com/en-us/aspnet/core/razor-pages/
Thanks.. fixed
>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.
https://github.com/dotnet/wcf/issues/8
This is a blocker for us moving from full framework version of WCF
Channel 9 link in the very last sentence is broken, should be https://channel9.msdn.com I believe
Great!
It means in the future updates asp.net core 2.0 sdk will not only support .net core 2.0 sdk but full .net framework.
cool!
typo: ab extra -> an extra
Which is the timeframe for the release of the final version of ASP.NET Core 2?
It’s posted all over, just look.
Your “Preview 1 Issues” section contradicts announcements on Github. Which is correct? What you posted here or the disaster here: https://github.com/aspnet/Home/issues/2022
Just one thing about the famous “ASP.Net Core does not run on full. Net” thing. In the respective github issue with hundreds (!) of comments, MSFT officials clearly stated this was not a mishap, not to have something to sell at Build, but in the opposite was done fully on purpose and that it will stay this way.
It would really help for MSFTs credibility if you get this story straight.
What about SignalR & WebHooks?
SignalR Core is coming in v2.1 around end of 2017.
Hi Jeff, Thanks for writing and sharing with us..
It is awesome to know .
One small catch Announcing ASP.NET 2.0.0-Preview1 -> should be corrected to Announcing ASP.NET Core 2.0.0-Preview1
What is needed to get ASP.NET Core 2.0 Preview1 to work with IIS? Has this changed from ASP.NET Core 1.x?
” 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” Where I don’t see it on the .net core download page
I like the http://dot.net url, but from there I can’t find any link to navigate to the ASP.NET Core 2 Preview 1 download! 🙂
https://www.microsoft.com/net/core/preview#windowscmd
Where should we report bugs on the Asp.Net identity template for this release?
I download the zip file of .net core 2.0 preview 1. Looks like it includes asp.net core 2.0 preview 1 stuff too? And EF Core 2.0 preview 1 stuff as well?
I struggled to find the asp.net core 2.0 preview1 stuff to download. Then it dawned on me to check the .net core 2.0 preview 1 to see if they included asp.net core 2.0 stuff with it.
When is Microsoft going to release a Web Forms replacement? As opposed to whatever this Angular/Razor crap that they’ve been pushing for the past 5 to 10 years.
Great article and thanks for presenting. I like to try https://docs.microsoft.com/en-us/aspnet/core/razor-pages/
So far developed 2 enterprise applications using Asp.net core and I’m really happy about performance and development experience. Hurray!
ASP.NET Core 2.0 preview is targeting .NETCoreApp 2.0. Why does it not target .NETStandard like the 1.x versions? Is this something that will change in coming previews? This makes it impossible to use the ASP.NET Core libraries in a .NET Standard library project.
Sorry I overlooked the “Preview 1 issues” section where this is explained. I thought this only applied to the .NET Framework though, but apparently also to .NET Standard.
Can we get some more info on the ASP.NET 4.7 Session state updates? I see the nuget packages have been published, but can’t find anything on them.
In particular it’s unclear to me what the result of setting AllowConcurrentRequestsPerSession to ‘false’ would be. Is RequestQueueLimitPerSession used regardless of AllowConcurrentRequestsPerSession being true of false?
Yeah, Razor compilation works and runs nicely when using VS 2017 15.3 preview.
But how can we get this to work with VS Code or the dotnet cli alone? I get 50 MB of DLLs and all the source views, instead of compact 5 MB from VS publish.