{"id":36894,"date":"2017-05-10T12:45:58","date_gmt":"2017-05-10T19:45:58","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/?p=9715"},"modified":"2017-05-10T12:45:58","modified_gmt":"2017-05-10T19:45:58","slug":"aspnet-2-preview-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/aspnet-2-preview-1\/","title":{"rendered":"Announcing ASP.NET Core 2.0.0-Preview1 and Updates for .NET Web Developers"},"content":{"rendered":"<p>The ASP.NET team is pleased to share the first preview version of the ASP.NET Core 2.0 framework.\u00a0 In this post, we\u2019ll look at the new features and changes to the web framework that were announced at the Build 2017 keynote and sessions.\u00a0 We will also look at some other updates that were published for ASP.NET 4.7 and WCF.<\/p>\n<h2>ASP.NET Core 2.0.0-preview1<\/h2>\n<p>The next full version of ASP.NET Core is on its way, and developers who have been following along on the <a href=\"https:\/\/github.com\/aspnet\">ASP.NET GitHub repositories<\/a> have been very vocal about their interest in the new features in this version.\u00a0 Some of these new features include:<\/p>\n<ul>\n<li>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\u2019t need in your application, our new package trimming features will exclude those binaries in your published application output by default.<\/li>\n<li>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.<\/li>\n<li><a href=\"https:\/\/github.com\/aspnet\/Announcements\/issues\/238\">Updated configuration and simplified logging<\/a>. We have enhanced the LoggerFactory object to easily support a Dictionary&lt;string, LogLevel&gt; 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.<\/li>\n<li>Create pages without controllers in ASP.NET Core with the <a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/razor-pages\/\">new RazorPages capabilities<\/a>.\u00a0 Just create a Pages folder and drop in a cshtml file with the new @page directive to get started.<\/li>\n<li>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.<\/li>\n<li>A newly revamped authentication model that makes it easy to configure authentication for your application using DI.<\/li>\n<li>New templates for configuring authentication for your web apps and web APIs using <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/active-directory-b2c\/\">Azure AD B2C<\/a><\/li>\n<li>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 <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/active-directory-b2c\/\">Azure AD B2C<\/a> or any other OpenID Connect compliant identity provider.<\/li>\n<li>Build secure web APIs using ASP.NET Core Identity. Acquire access tokens for accessing your web APIs using the <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Identity.Client\">Microsoft Authentication Library (MSAL)<\/a><\/li>\n<li>NET Core has always helped HTMLEncode your content by default, but with the new version we\u2019re 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.<\/li>\n<\/ul>\n<p>For a full list of changes see the <a href=\"https:\/\/github.com\/aspnet\/Home\/releases\/tag\/2.0.0-preview1\"><\/a><a href=\"https:\/\/github.com\/aspnet\/Home\/releases\/tag\/2.0.0-preview1\"><\/a><a href=\"https:\/\/github.com\/aspnet\/Home\/releases\/tag\/2.0.0-preview1\">release notes.<\/a><\/p>\n<h2>ASP.NET Core 2 \u2013 More Performance Improvements<\/h2>\n<p>ASP.NET Core 1 was ranked in the top 10 of the <a href=\"http:\/\/www.techempower.com\/benchmarks\/#section=data-r13&amp;hw=ph&amp;test=plaintext\">TechEmpower plaintext benchmarks in November 2016<\/a>.\u00a0 We\u2019ve continued to work on our performance, and we\u2019re already seeing improvements thanks to enhancements in the Kestrel server, thread pool, and JITter, to name just a few.<\/p>\n<p>We are also providing a runtime store with pre-JITted versions of all of the ASP.NET Core packages we ship.\u00a0 This reduces a lot of the work needed at startup time for your application.\u00a0 Our initial tests reflect a significant improvement in startup time and we&#8217;re continuing to work on optimizing the store for subsequent releases.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2017\/05\/AspNet2Preview1Graph1-1.png\" class=\"aligncenter wp-image-9737 size-full\" width=\"909\" height=\"547\" \/><\/p>\n<p>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.<\/p>\n<h2>ASP.NET 4.7 \u2013 SQL Server, Session Provider, and OutputCache Provider<\/h2>\n<p>We\u2019re also announcing an update to the SQL Server session provider and Session State module this week for ASP.NET 4.7\u00a0 This provider contains updates that will help you with modern web applications.\u00a0 We see customers with JavaScript that makes multiple concurrent requests to the server for data.\u00a0 These requests, by default, lock the session object and prevent concurrent requests.\u00a0 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.\u00a0 The updated session state module ships with an updated In-Memory provider, the default provider with ASP.NET<\/p>\n<p>The SQL Server provider has been optimized for SQL Server versions 2008 and later, as well as for Azure SQL Server.\u00a0 All requests to the database are asynchronous and should help with concurrent request performance on your web applications.\u00a0 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.\u00a0 The database provider also works with the new concurrent requests mode.\u00a0 Finally, the provider has been optimized to use <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/in-memory-oltp\/in-memory-oltp-in-memory-optimization\">in-memory OLTP on SQL Server 2016 and SQL Azure<\/a>.<\/p>\n<p>Activate the updated Session Provider\u2019s concurrent requests per session feature with the following AppSettings:<\/p>\n<pre>&lt;add key=\"aspnet:AllowConcurrentRequestsPerSession\" value=\"true\" \/&gt;\n  &lt;add key=\"aspnet:RequestQueueLimitPerSession\" value=\"100\" \/&gt;<\/pre>\n<p>The SQL Server OutputCache provider has been updated and now utilize asynchronous IO as well.\u00a0 You can reference the updated provider with this markup in your web.config:<\/p>\n<pre>&lt;caching&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;outputCache defaultProvider=\"SQLAsyncOutputCacheProvider\"&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;providers&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;add name=\"SQLAsyncOutputCacheProvider\" connectionStringName=\"DefaultConnection1\" type=\"Microsoft.AspNet.OutputCache.SQLAsyncOutputCacheProvider.SQLAsyncOutputCacheProvider, Microsoft.AspNet.OutputCache.SQLAsyncOutputCacheProvider\" \/&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/providers&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/outputCache&gt;\n&lt;\/caching&gt;\n\n&lt;modules&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;remove name=\"OutputCache\" \/&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;add name=\"OutputCache\" type=\"Microsoft.AspNet.OutputCache.OutputCacheModuleAsync, Microsoft.AspNet.OutputCache.OutputCacheModuleAsync\" preCondition=\"integratedMode\" \/&gt;\n&lt;\/modules&gt;<\/pre>\n<p>We expect to release these packages next week.\u00a0 You will be able to install the providers for ASP.NET 4.7 from NuGet:<\/p>\n<ul>\n<li>Install-Package Microsoft.AspNet.OutputCache.OutputCacheModuleAsync<\/li>\n<li>Install-Package Microsoft.AspNet.OutputCache.SQLAsyncOutputCacheProvider<\/li>\n<li>Install-Package Microsoft.AspNet.SessionState.SessionStateModule<\/li>\n<li>Install-Package Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync<\/li>\n<\/ul>\n<p>We\u2019ll post an update when they are available.<\/p>\n<h2>WCF Connected Services and Containers<\/h2>\n<p>The WCF team has issued an update to the WCF Connected Service extension for Visual Studio 2017 and .NET Core.\u00a0 This extension provides the same \u201cAdd Connected Service\u201d feature that you\u2019re familiar with in .NET Framework.\u00a0 The tool makes it much simpler to configure.NET Core 1.x projects that need to connect to WCF end points.\u00a0 A future update will enable connectivity from .NET Core 2.0 projects. Install the extension for Visual Studio 2017 from the <a href=\"https:\/\/marketplace.visualstudio.com\/\">Visual Studio Marketplace<\/a>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2017\/05\/ConnectedWcfService-1.png\" alt=\"Connected WCF Service Extension\" class=\"aligncenter size-full wp-image-9735\" width=\"625\" height=\"425\" \/><\/p>\n<p>Last week we quietly published a WCF Docker image to assist in shifting HTTP services to Docker Windows containers.\u00a0 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.\u00a0 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:<\/p>\n<pre>FROM microsoft\/wcf\n\nRUN mkdir C:WcfService\n\nRUN powershell -NoProfile -Command \n\u00a0\u00a0\u00a0 Import-module IISAdministration; \n\u00a0\u00a0\u00a0 New-IISSite -Name \"WcfService\" -PhysicalPath C:WcfService -BindingInformation \"*:83:\"\n\nEXPOSE 83\n\nADD content\/ \/WcfService<\/pre>\n<p>More details and samples with this image can be found on the <a href=\"https:\/\/github.com\/microsoft\/wcf-docker\">WCF docker image repository<\/a>.\u00a0 Details are also available if you would like to run the <a href=\"https:\/\/github.com\/dotnet\/wcf\/blob\/master\/Documentation\/HowToUseWCFInContainers.md\">WCF client for .NET Core in a container<\/a>.<\/p>\n<p>Are you interested in working with other endpoints or security with WCF services in containers?\u00a0 Let us know what features you want to see in our next set of updates for WCF container images in the comments area below.<\/p>\n<h2>Preview 1 Issues<\/h2>\n<p>This preview version of ASP.NET Core 2.0 ships with support for the .NET Core 2.0 SDK only.\u00a0 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.\u00a0 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\u2019s 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.<\/p>\n<h2>Summary<\/h2>\n<p>The .NET teams have been very busy, and brought a bunch of updates to Build for all of our web frameworks.\u00a0 After the conference completes. We\u2019ll publish another post with links to videos from our sessions about all of these features and samples.\u00a0 You can watch some of our sessions online at <a href=\"https:\/\/channel9.msdn.com\">Channel 9<\/a> and you can download the ASP.NET Core 2 Preview 1 release from <a href=\"http:\/\/dot.net\">http:\/\/dot.net<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ASP.NET team is pleased to share the first preview version of the ASP.NET Core 2.0 framework.\u00a0 In this post, we\u2019ll look at the new features and changes to the web framework that were announced at the Build 2017 keynote and sessions.\u00a0 We will also look at some other updates that were published for ASP.NET [&hellip;]<\/p>\n","protected":false},"author":405,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197,7509],"tags":[30,7265,7339],"class_list":["post-36894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","category-aspnetcore","tag-announcement","tag-announcements","tag-wcf"],"acf":[],"blog_post_summary":"<p>The ASP.NET team is pleased to share the first preview version of the ASP.NET Core 2.0 framework.\u00a0 In this post, we\u2019ll look at the new features and changes to the web framework that were announced at the Build 2017 keynote and sessions.\u00a0 We will also look at some other updates that were published for ASP.NET [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/36894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/405"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=36894"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/36894\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=36894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=36894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=36894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}