Quick Introduction to ASP .NET core 1.1.
Being a custom software development expert in Microsoft technologies, Diatom has expertise not only in .NET Framework but also in .NET Core. In the following article, we will primarily focus on the .NET Core technology.
First, we will quickly review the history of server-side scripting technology to gain a better understanding of where we are right now and what we should expect in the near future.
We will also review the advantages and disadvantages of the new .NET Core technology and determine the usage scope for .NET Core. Our review will include a brief comparison of the speeds of request handling in the current .NET Framework vs .NET Core.
As the final part of this article, we have information for developers on how to prepare a .NET Core environment on different operating systems, including Windows 10, macOS X and Linux (Ubuntu 17), together with a review of an open source solution for .NET Core developers called Visual Studio Code.
An additional part of the following article includes writing a simple .NET Core application – for mobile and desktop – with a demonstration of how to run it on different operating systems, including Windows 10, macOS X and Linux (Ubuntu 17).
HISTORY
A brief review of server-side script engines for dynamically generated webpages produced by Microsoft.
Ancient history – Pure “ASP” aka “ASP Classic”
Between 1996 and 2000, three versions of ASP were released. ASP was the first version of the server-side script engine from Microsoft for dynamically generated webpages. The last version of ASP (3.0) was released in 2000. ASP support was still included in the modern Windows NT 2016 operating system. Support for the old ASP will be discontinued in 2020.
ASP technology was superseded by ASP.NET framework in 2002; however, some companies and government organizations still have projects using classic ASP.
ASP.NET Framework
Web Forms
The first version of Web Forms, released in 2002, introduced a new web development process.
Web Forms is the first rapid application development (RAD) / VISUAL programming platform for the web. Its main purpose was to make web development processes very easy and fast, like visual application development for Windows OS.
MVC
MVC is a web application framework with an MVC architecture coding style (pattern) and was released in 2009. A community technology preview became available two years before its first official release.
The main purposes and advantages of the MVC architecture coding style compared to regular Web Forms are the following:
- Avoids spaghetti code
- Makes everything unit-testable
Perhaps in the near future, ASP.NET Framework will be superseded by the next generation of ASP.NET Framework – ASP.NET Core.
ASP.NET Core – next generation of ASP.NET Framework
Released in 2016. Previous code name: ASP.NET vNext and ASP.NET 5.
GENERAL TIMELINE OF SERVER-SIDE SCRIPTING TECHNOLOGY FOR WWW
Below is a simplified schematic review of server-side scripting technology for WWW from Microsoft.
Each software product has its own life-cycle, which contains multiple steps. Here we highlight three of the primary steps:
- Active development and improvement
- Stagnation
- Disposal
As you can see, ASP.NET 5.0 framework was never released. ASP.NET 5.0 became ASP.NET Core 1.0.
1. What is ASP.NET Core?
– ASP.NET Core is a significant redesign of ASP.NET Framework.
– ASP.NET Core is an open source, cross-platform framework for building modern, cloud-based, internet-connected applications that can be developed and run on Windows, Linux and macOS.
– ASP.NET Core includes the MVC framework, which now combines the features of MVC and Web API into a single web programming framework. ASP.NET Core is built on the .NET Core runtime.
2. ASP.NET Core on .NET Core
ASP.NET Core on .NET Core is cross-platform ASP.NET Core.
3. ASP.NET Core on .NET Framework
ASP.NET Core on .NET Framework is ASP.NET Core for the full/desktop .NET Framework (e.g. .NET Framework 4.6.2). These applications can only run on Windows, but everything else about ASP.NET Core behaves the same way.
FAQ
- So, in a few words, what is ASP.NET Core?
A. ASP.NET Core is the next generation of .NET Framework. - Does that mean that .NET Framework is dead?
A. Not completely. .NET Framework is still a mainstream product and will continue development, but we should not expect significant improvements or changes to .NET Framework. In fact, .NET Framework may soon become a “second-class citizen.” Do not forget that .NET Framework 5.0 has become ASP.NET Core 1.0! - Okay, I am a software developer. What should I expect?
A. We can assume that .NET Core will now be growing much faster than the existing .NET Framework.
Review
“ASP.NET 5 is dead – Introducing ASP.NET Core 1.0 and .NET Core 1.1”
- NET 5 is now ASP.NET Core 1.0.
- .NET Core 5 is now .NET Core 1.0.
- Entity Framework 7 is now Entity Framework Core 1.0.
Why version 1.0? Because .NET Core was completely rewritten. The whole concept of .NET Core is totally new.
To avoid the misunderstanding that this is an update to the existing ASP.NET framework, Microsoft made the decision to change the name to ASP.NET Core.
ASP.NET and ASP.NET Core
.NET Framework and .NET Core
Basically, .NET Core is a spin-off from the existing .NET Framework, completely redesigned to meet modern requirements over the next 5 to 10 years.
BCL – Base Core Library
Advantages
- One single framework – not a collection of frameworks like .NET Framework
- Build and run cross-platform ASP.NET apps on Windows, macOS X and Linux
- Open platform. All solutions from Microsoft originally come as open source solutions
- Cloud-optimized runtime
- Based on MVC architecture coding style
- Simple source code (Microsoft Visual Studio Code) editor available for Linux, macOS X and Windows platforms. Open source editor with debugger, syntax highlight and core refactoring features
- Delivery as NuGet package
- More decomposition level
Disadvantages
- New and therefore not yet fully battle-tested
- So far, no “Web Pages;” however, these are planned for the future
- So far, no VB or F# support; however, this is planned for the future
- Does not have all the functionality of ASP.NET 4.x stack technology
- Slower compiling speed compared to .NET Framework
- Slow publishing speed
- Not all packages delivered via NuGet currently compatible with ASP.NET Core, even packages produced by Microsoft
ASP.NET CORE BENCHMARK
According to the pre-release version of ASP.NET Core (February 2016), benchmark results look like the following:
- NET 4.6: <50K req/sec
- NET Core (CLR): 400K req/sec
- NET Core (.NET Core, Linux): 900K req/sec
- NET Core (.NET Core, Windows): >1.1M req/sec
Comparing ASP.NET Core (pre-release) and ASP.NET 4.6 – performance increased to 2300%:
Running on an Azure G4 VM, you can see we can hit 12.6 Gbps while only using 36% CPU:
USAGE SCOPE
There are two supported choices of runtime for building server-side applications with .NET: .NET Framework and .NET Core. Both share a lot of the same .NET platform components, and you can share code across the two. However, there are fundamental differences between the two, and your choice will depend on what you want to accomplish.
1. When you should use ASP.NET Core
- You have cross-platform needs.
- You are targeting micro-services.
- You are using Docker containers.
- You need high performance and scalable systems.
- You need side-by-side.NET versions by application.
2. When you should use ASP.NET Framework
- Your application currently uses .NET Framework (recommendation is to extend instead of migrating).
- You need to use third-party .NET libraries or NuGet packages not available for .NET Core.
- You need to use .NET technologies that are not available for .NET Core.
- You need to use a platform that doesn’t support .NET Core.
DEMONSTRATION
Each language and platform must have its own ‘Hello World’ program. As a proof of concept, I did one simple console application, which you could run on Windows, Linux and macOS.
1. Console application
Running .NET Core 1.1 console application under Windows OS
Running .NET Core 1.1 console application under OSX
Running .NET Core 1.1 console application under Linux
2. Web application
Running .NET Core 1.1 web application under Windows OS
Running .NET Core 1.1 web application under OSX
INFORMATION FOR DEVELOPERS
1. MAC OS
Read the full step-by-step installation manual about how to install .NET Core SDK – minimal set to run a .NET Core application at Microsoft.
Ready to install
Installation process is complete
Verify that .NET Core 1.1 SDK has successfully installed
Testing our .NET Core 1.1. console application
2. Visual Studio
Most importantly and with huge benefits, Visual Studio IDE environment (free Community edition) is available for macOS X.
Ready to install
Customize your installation options
Installation process
Installation process has successfully completed
Running Visual Studio Community edition on macOS
3. LINUX
Currently available only for 64bit OS. Latest version of Ubuntu, version 17, is not currently supported. Supported versions of Ubuntu include versions 14 and 16
.NET Core 1.1.2 SDK can be downloaded from Microsoft.
No special installation is required.
Verify that .NET Core 1.1 SDK successfully installed
Testing our .NET Core 1.1 console application
4. Visual Studio Code
This is another free and multiplatform IDE.
Visual Studio Code is a lightweight but powerful source code editor that runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP and Go) and runtimes (such as .NET and Unity).
Visual Studio Code gives you access to a lot of different free multiplatform extensions. There are over 3,100 extensions currently available (as of May 2017), separated into 9 major categories, like:
- Debugging tools
- Programming languages
- Formatters
Examples of different free multiplatform extensions
Screen shot of Visual Studio Code running on Linux OS
Screen shot of Visual Studio Code running on Mac OS
CONCLUSION
.NET Core is the next generation of server-side scripting technology.
.NET Core is many times faster than existing .NET Framework.
.NET Core is open source.
Applications written on.NET Core are multiplatform ready.
.NET Core has developing tools for different platforms (Linux, Windows, macOS).
.NET Core provides its own fast web server.
.NET Core requires minimal time for deployment.
You can use .NET Core to write multiplatform applications or build full Windows applications.
ADDITIONAL LINKS
- NET 5 is dead – Introducing ASP.NET Core 1.0 and .NET Core 1.0
https://blogs.msdn.microsoft.com/webdev/2016/01/19/asp-net-5-is-dead-introducing-asp-net-core-1-0-and-net-core-1-0/
- Choosing between .NET Core and .NET Framework for server apps
https://docs.microsoft.com/en-us/dotnet/articles/standard/choosing-core-framework-server
- NET Core – 2300% More Requests Served Per Second
https://www.ageofascent.com/2016/02/18/asp-net-core-exeeds-1-15-million-requests-12-6-gbps/
- Introduction to .NET Core
https://blogs.msdn.microsoft.com/dotnet/2014/12/04/introducing-net-core/
- Announcing ASP.NET Core 1.0
https://blogs.msdn.microsoft.com/webdev/2016/06/27/announcing-asp-net-core-1-0/
- Market place for the Visual Studio family of products
https://marketplace.visualstudio.com/VSCode
- NET Core and .NET Core Overview
https://weblog.west-wind.com/posts/2016/jun/13/aspnet-core-and-net-core-overview