Join Jess Chadwick for an in-depth discussion in this video The building blocks of an ASP.NET 5 application, part of Up and Running with ASP.NET 5.
- In this course, I'm going to show you everything you need to know in order to build and deploy web applications with ASP.NET 5, and I'll start in this video by giving you a high level overview of what exactly makes up an ASP.NET 5 application. Consider your deployed application as a bunch of layers, each one building on top of the other. All the way down at the bottom is the Operating System, because, of course, you can't run any applications, web or otherwise, without an Operating System. On top of the Operating System sits the Web Server, also referred to as the web host or, sometimes, the web listener.
This is the layer that accepts network requests routed by the operating system, and passes the request off to an application framework. Many web servers have built in functionalities such as content caching, and the ability to serve static files without having to execute the application framework. Next us is the .NET Runtime itself. This is a very thin layer whose only job is to load .NET libraries, locate the entry point into the application, and execute it whenever a request is passed to it by the Web Server.
These three components collectively provide the abstraction that hosts and executes application code, such that the application doesn't ever need to worry about the low level details of handling requests and responses. In fact, consider there to be a line above this layer. Above that line is all of the code that defines the application, below the line is all the infrastructure required to host and execute the application, infrastructure that the application never directly interacts with.
The next layer in the stack, the first layer of the application, are the .NET libraries written by Microsoft, that provide the abstractions, data structures, and core implementations of things such as collections, files, and network IO. Practically speaking, this layer contains the things that pretty much every application will need. On top of the .NET Libraries sit the Third-Party Libraries. By the third-party here, I really just mean any library that was not written by your team, or Microsoft. Much like the .NET Libraries, these libraries provide reusable implementation of things that are commonly needed among applications, for instance: web diagnostics or JSON serialization libraries.
In previous versions of the framework these two layers were very distinctly different. The .NET Runtime and Libraries were installed centrally on the machine itself, and in order to leverage Third-Party Libraries you had to go and download them from the Internet, and include them right alongside your application. However, as I'll explain in detail throughout the course, in this version of ASP.NET, you now need to download, and even include, Microsoft's own .NET Libraries alongside your application libraries in order to use them. So, really, the differentiation between these two layers is pretty thin.
In fact, when it comes to any code above the line, you can just really consider it two layers: your code, and other people's code. It's pretty much as simple as that. And, finally, we have the Application Code layer at the top. This is the code that you are going to write that defines how your application should handle web requests. In other words, this is the code that makes your appliation your application. Now that I've explained the whole stack, let me jump back to the differentiation I made between the layers above and below that line. Perhaps the most significant difference between the two is that the layers above the line often reference each other, they're aware of each other.
However, these layers rarely, if ever, directly reference the layers underneath them. In fact, for the most part, they don't even really know that they're there. The net result of this is that once the application is defined in the layers above the line, that application code can run on any compatible implementation of the layers below the line. For instance, version 5 of ASP.NET is being launched alongside a brand new version of the full .NET Framework called .NET Core. .NET Core is a lightweight, fast, and modular version of the full .NET Framework, fully rewritten from the ground up.
I'll talk a little more about .NET Core in later videos, but what you need to know right now is that when it comes time to deploy your ASP.NET 5 application you've got a choice between the full .Net Framework, or the slimmed .NET Core, your application will work on either one. Perhaps more importantly than how lightweight the .NET Core Framework is, is the fact that it's cross-platform unlike the full .NET Framework, which only runs on Windows. Likewise, previous versions of ASP.NET were pretty tightly coupled to both Widows and the IIS Web Server that comes with Windows, but ASP.NET 5 also takes full advantage of .NET Core support for cross-platform compatability.
This opens up a whole new world of options and opportunities for developers, as the net result of all of that is that the developers can run their applications on pretty much any web server running on Windows, Mac, or Linux. Throughout the rest of this course I'll be developing my code using Visual Studio on Windows, and editing it in IIS Express, the lightweight version of IIS. However, rest assured that everything I show you in this course will also run just fine in any other configuration I'm showing here. And now that I've introduced you to the building blocks of an ASP.NET application, keep moving on to the next video where I'll get into a little more detail about the differences between ASP.NET 5 and previous versions of the ASP.NET Framework for those of you who have used ASP.NET in the past.
If that doesn't apply to you, if this course is your first time learning and using ASP.NET, feel free to just skip this next video and jump right into the next chapter to start learning.
- Understanding ASP.NET 5's new request processing pipeline
- Downloading client-side libraries using Grunt and Bower in Visual Studio
- Adding ASP.NET MVC 6 to your application
- Handling web requests with controllers
- Rendering dynamic views with Razor markup
- Using Entity Framework to write and read data to a database
- Using TagHelpers to create simple dynamic HTML forms
- Registering and authenticating users with Identity services
- Dynamically update portions on the server using partial rendering
- Using dynamic routing logic to customize URLs
- Exposing data with web APIs
- Leveraging custom configuration and logging
- Increasing application maintainability with dependency injection