- It has an internal web server called Kestral that runs in coordination(collaboration) with the external webserver (assume IIS).
The IIS invokes the .net runtime which looks for the main method in the application and executes it. This starts Kestral.
https://app.pluralsight.com/player?course=understanding-aspdotnet-core-2x&author=roland-guijt&name=1e5802e8-d4b6-4784-a8f6-93d1739c88ba&clip=9&mode=live
Most versions of classic ASP. NET relied on an assembly in a. NET Framework called System. Web, which was tied to IIS. It is not suitable anymore for today's standards. It is around since classic ASP. NET version 1, and as ASP. NET progressed, stuffed with code to support all kinds of new features. Processing a request using System. Web isn't very efficient anymore for that reason in terms of memory usage and performance. Using the pipeline, youonly plug in what you need, and everything you plug in is in separate assemblies exposed in NuGet. System. Web relied on IIS, and IIS is tied to Windows. That'sthe reason you can't run classic ASP. NET apps on other web servers than IIS, and only on Windows. Now that this limitation is lifted, in ASP. NET Core you can runapps on many external web servers for many operating systems. Keep in mind that there are actually two web servers, one web server that I call the external webserver. This is a full-blown production-ready web server like IIS, Apache, or NGNIX on Linux, for example. There's also an internal web server, part of and hosted by your app. Requests to the external web server are proxied to the internal web server, and vice versa. Like the external web server, you're also not tied to using a specific internal web server. The most obvious choice is Kestrel because it's very fast, it is implemented cross-platform, and it has first-class support in ASP. NET Core. Kestrel is a lightweight web server; it doesn't have much more features than actually executing a request. That's why you need an external web server in production scenarios, which you can configure security, configure caching and compression, set up mappings to the right app depending on the URL, and many more things.
The use method has a parameter next which helps the execution to continue as the execution stops if the next element in the pipeline is not called manually. This is the case when we add our own elements to the pipeline. Everything before the await happens during the incoming request processing and after all the pipeline elements have been processed everything after the next() will be executed.
Unified Controllers
Earlier ASP. NET versions had a clear distinction between MVC, the framework for web user interfaces, and web API, the framework for REST web services, also known as APIs, that expose data only. Web API was created following the exact same model MVC uses. It, in fact, also uses the MVC pattern used in types that are in most cases named exactly like the types used in MVC. One of the reasons to build web API completely separate from MVC, even though it matches one to one, was because MVC relied on the System. Web assembly, which is tied to IIS and Windows. Microsoft wanted to untie a web API from System. Web, which among other benefits gave web API applications the ability to be self-hosted. Now that all of ASP. NET Core doesn't use System. Web anymore, it doesn't really make sense anymore to have two sets of types that do almost the same thing. In ASP. NET Core there is just one set of types to support the functionality of MVC and a web API. And because everything is unified now, having multiple names for the same thing also doesn't make sense, so the name web API has been dropped. The combined functionality of MVC and web API is now just called ASP. NET Core MVC.
Comments
Post a Comment