text
stringlengths
0
13.4k
6
Introduction
Why do we need another web
framework?
There are a lot of great web frameworks to choose from already:
Node/Express, Spring, Ruby on Rails, Django, Laravel, and many more.
What advantages does ASP.NET Core have?
Speed. ASP.NET Core is fast. Because .NET code is compiled, it
executes much faster than code in interpreted languages like
JavaScript or Ruby. ASP.NET Core is also optimized for
multithreading and asynchronous tasks. It's common to see a 5-10x
speed improvement over code written in Node.js.
Ecosystem. ASP.NET Core may be new, but .NET has been around
for a long time. There are thousands of packages available on NuGet
(the .NET package manager; think npm, Ruby gems, or Maven).
There are already packages available for JSON deserialization,
database connectors, PDF generation, or almost anything else you
can think of.
Security. The team at Microsoft takes security seriously, and
ASP.NET Core is built to be secure from the ground up. It handles
things like sanitizing input data and preventing cross-site request
forgery (CSRF) attacks, so you don't have to. You also get the
benefit of static typing with the .NET compiler, which is like having a
very paranoid linter turned on at all times. This makes it harder to do
something you didn't intend with a variable or chunk of data.
.NET Core and .NET Standard
Throughout this book, you'll be learning about ASP.NET Core (the web
framework). I'll occasionally mention the .NET runtime, the supporting
library that runs .NET code. If this already sounds like Greek to you, just
7
Introduction
skip to the next chapter!
You may also hear about .NET Core and .NET Standard. The naming gets
confusing, so here's a simple explanation:
.NET Standard is a platform-agnostic interface that defines features and
APIs. It's important to note that .NET Standard doesn't represent any
actual code or functionality, just the API definition. There are different
"versions" or levels of .NET Standard that reflect how many APIs are
available (or how wide the API surface area is). For example, .NET
Standard 2.0 has more APIs available than .NET Standard 1.5, which has
more APIs than .NET Standard 1.0.
.NET Core is the .NET runtime that can be installed on Windows, Mac, or
Linux. It implements the APIs defined in the .NET Standard interface with
the appropriate platform-specific code on each operating system. This is
what you'll install on your own machine to build and run ASP.NET Core
applications.
And just for good measure, .NET Framework is a different
implementation of .NET Standard that is Windows-only. This was the
only .NET runtime until .NET Core came along and brought .NET to Mac
and Linux. ASP.NET Core can also run on Windows-only .NET
Framework, but I won't touch on this too much.