These are my notes from the Microsoft Web Platform Day event I attended in Birmingham on Thursday May 19.
ASP.NET Core is the new Microsoft web framework currently in RC2. Microsoft has the ambition to make it the fastest web framework in the world. It is not quite there yet with 1.2 million requests per second (to serve text with an empty pipeline) but the target for RTM is to able to serve 5 million requests per second.
Main points:
- Open Source
- The framework is just 3 Megabytes in size
- The framework can be packaged with your application (no need of painful .NET installations with risk of breaking changes)
- It is modular (via NuGet). You only add what you want in the pipeline
- Super fast!
- Can be used on Windows and Linux (Mac for development only)
- Can be hosted in a new cross platform web server (Kestrel)
- Can sit on top of .NET or the new .NET Core
If you only plan to host your site on Windows, hosting it on .NET is the best option because most of the libraries do not target .NET Core just yet.
Microsoft provides a set of VMs to test your website on all versions of Internet Explorer and Edge at the following address https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/windows/
Microsoft provides a tool to scan your website to help finding compatibility issues on Edge https://developer.microsoft.com/en-us/microsoft-edge/tools/staticscan/
Bower is used for handling client site dependencies and it is the default option (you can also use npm).
All the MVC part is going to be familiar to ASP.NET MVC developers. The only meaningful addition are the Tag Helpers.
JS Task Runners are the new way to manager JS build tasks (no need to use MsBuild) and Gulp is the default option. You can intercept Visual Studio events and trigger the execution of JS tasks. Gulp has a tons of plugins like gulp-autoprefixer that automatically add cross-browser vendor prefix to your css.
The new ASP.NET Core framework unify MVC and WebApi. However, support for Web API is still under active development and it is not quite ready yet (missing security, OData support).
Microsoft re-write Entity Framework from scratch and it is called Entity Framework Core. The generated SQL aim to be of “DBA quality”. EF Core is cross platform, support different relational databases (Postgres SQL, SQL Lite, SQL Server, …), support No SQL stores and focus on code first development. EF Core also provide an InMemory database to be used for unit testing. EF Core is still under active development. At the time, Entity Framework 6 is the recommended choice for production.
Azure support continuous deployment from github. Azure Deployment Slots can be used for A/B testing and to enable staged deployments.
Visual Studio provides a “Load Test Project” that allows you to easily simulate a lot of requests to your site using Azure. This is a great resource to test how your website running on Azure scale.
Tip: server your static files from the Azure Storage. It is a lot quicker!
The latest version of Javascript (ECMAScript 2015) add the following concept to the language:
- classes (inside classes this has always the same meaning)
- Lambdas
- Consts
- Template strings
- For each loop
- Let to scope variables
- Default values for parameters in functions
- Ability to map an array to parameters of a function
- Ability to take a variable number of arguments in a function
The Microsoft Cognitive Services are a set of API to make machine learning easy to use.
Google use your site speed as part of the ranking! 87% of the traffic is front-end so it’s wise to focus on optimizing the front-end before than the back-end.
- There are various tools to evaluate your site performance: WebDevChecklist, Yahoo YSlow and Google Page Speed Insights.
- Always set the expires header for static resources to leverage browser caching (there is a gulp plugin that does that).
- Enable browser caching in the web.config.
- Use images as font (Font Awesome is a good collection).
- Enable dynamic/static compression in web.config.
There are a lot of JS MVC frameworks out there. There is a TodoMVC application built in any JS framework that is good for comparison. http://todomvc.com/
Angular.js 2 is predicted to be hugely popular and will be the de facto client framework for ASP.NET Core websites. There is a full team at Microsoft that is looking into integrating the two frameworks to make the overall experience great. This also means that Typescript is going to be used a lot more in the future. Microsoft and Google are working together!
Finally they introduced the ManifoldJs project that helps to create Hybrid Web Apps. The tool automatically generated the source code to target all the main platforms (Android, IPhone, …). They also demonstrated how to call native Windows 10 APIs using JS.
All the slides and the code shown during the event can be found at the following address http://mswebday.net/#content