Experts working in reputed .net development company India are sharing step-by-step guide to explain how to update an existing app to asp.net core 1.1. You can follow the guide shared by them and update your applications to .net core 1.1 RTM. You will also read about significant features of this update
The latest release of Asp.net Core is made available on nuget.org. Many new features, enhancements and bug fixes are available in Asp.Net Core 1.1.
Perform the following steps for updating an existing application to Asp.Net Core 1.1.
- Download the SDK of .Net Core 1.1 and install the same.
- If the application is referenced by .Net Core framework, then update all references in project.json file for Microsoft.NetCore.App versions 1.0 to 1.1 and NETCOREAPP version 1.1. The following two updates are shown in default project.json file for an application.
- Update all dependencies of Asp.Net packages to newer versions. It can be achieved by looking into the updates tab in Nuget Package Manager and install the required updates as shown below.
Side by Side Installation:
After installing the newer version of SDK, default behaviour of Dotnet command will get updated. Now it will process the csproj projects and make use of msbuild rather than using project.json file. Similarly, a profile file of csproj will be created by Dotnet new.
Also it is possible to use the tools based on project.json file by creating a global.json file in project directory and adding sdk property into it as shown below:
"sdk": { "version": "1.0.0-preview2-003131" }
Performance:
Asp.net Core has great participation with kestrel webserver in TechEmpower benchmarks of round 13. These benchmarks are famous for their testing of available web frameworks. From the most recent results of TechEmpower, Kestrel with Asp.net Core 1.1 was given the first rank as the fastest web framework. As reported by TechEmpower, Asp.net Core 1.1 runs 760 times faster as compared to a year ago. Since March 2013, they have seen a tremendous increase in performance in Asp.net Core.
New Features in Visual Studio 2017:
- New editor for JavaScript.
- Embedded capabilities of ESLint that will help in checking mistakes from the script.
- Support to browser for JavaScript debugging.
- Two way communication among visual studio and browser during debugging through browselink feature.
New features in Asp.net 1.1
Asp.net 1.1 was designed keeping following features in mind:
- Improved hosting capabilities and cross-platform for hosts other than IIS.
- Support to develop with native Windows abilities.
- Performance, portability and compatibility of middleware and other features of MVC with the help of UI framework.
- Improved management and deployment experience in applications of Asp.Net Core on Azure.
These features make Asp.Net Core as the best option of cloud applications.
URL Rewriting Middleware
Asp.Net Core is able to perform URL rewriting with the help of a middleware component. The same can be easily configured with IIS formatted rules of XML, Apache syntax of Mod_Rewrite or few C# methods of application. In case, the applications of Asp.Net Core needs to be run outside IIS, the URL Rewriting abilities needs to be enabled irrespective of the host. ASP.Net Core will automatically manage it in case Apache, NGINX or containers are used.
URL rewriting maps space for public URL, designed for the client’s consumption to the required representation by the middleware pipeline downstream components and redirects clients to the URLs on the basis of pattern.
To use middleware in web applications, add a reference to Microsoft.AspNetCore.Rewrite package. It will create a call for configuring rewrite options in the rewriter in Startup.Configure method.
Response caching Middleware:
It works like the Output cache capability of previous releases of Asp.Net. It can be easily activated in application by referencing Microsoft.AspNetCore.ResponseCaching as well as Microsoft.Extensions.Caching.Memory packages in application. The middleware can be added in the method of StartUp.ConfigureService and the response caching will be configured from StartUp.Configure method.
It is now possible to add a GZIPCompression in Asp.Net pipeline in case the compression needs to be done by Asp.Net rather than a web server. Generally, it will be handled by IIS. However, in situations where the compression capabilities are not provided by Aon, Asp.net core will handle the same.
The middleware can be found in package Microsoft.AspNetCore.ResponseCompression.
Windows Web Listener Server:
Weblistener is a kind of server that executes on API of Windows Http Server. Developers can take benefit of specific Windows features such as HTTPs, port sharing, Window Authentication etc. by using Webserver.
In the current Release, WebListener is shipped as 1.0.0 as well as 1.1.0. The version of 1.0.0 is used for production LTS in Asp.Net applications. The version 1.1.0 is the upcoming version that is the part of 1.1.0 release.
Middleware as MVC Filters:
The middleware lies in the pipeline of global request handling. Now it is also possible to apply the middleware to particular action or controller with the help of the MiddlewareFilter property. As an example, it is possible to apply caching or response compression with it.
In order to use middleware in the form of a filter, firstly it is required to add a type by using the Configure method that will help in specifying the pipeline of the middleware.
TempData provider based on Cookies:
To use the tempdata provider based on cookies, register the service of CookieTempDataProvider in the method of ConfigureServices after the MVC service is added as shown below:
services.AddMvc(); services.AddSingleton<ITempDataProvider, CookieTempDataProvider>();
View Compilation:
To enable compilation of views while publishing the application, perform the following steps:
- Below the dependency section, add reference to Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.
- Below the tools section, add reference to Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.
- In order to invoke the View Compiler, add a script to postpublish as follows:
"scripts": { "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" }
Service Logging Provider for Azure
It is possible to service specific diagnostics and logging using the Microsoft.AspNetCore.AzureAppServicesIntegration package. The log messages written with the help of abstractions of ILoggerFactory/ILogger will be found in the configured locations of App service in the section of diagnostic logs. This provided is higher recommended in cases when an application is deployed to Azure services.
The purpose of sharing this post is to let people know how to update their existing applications to asp.net core 1.1. .Net development company India experts have shared complete guide and features of this update. If you have not got any point, ask in comments.