Dotnet Core Interview Que Ans
Dotnet Core Interview Que Ans
What is middleware?
It is software which is injected into the application pipeline to handle request and
responses. They are just like chained to each other and form as a pipeline. The
incoming requests are passes through this pipeline where all middleware is
configured, and middleware can perform some action on the request before passes it
to the next middleware. Same as for the responses, they are also passing through the
middleware but in reverse order.
What is the use of "Map" extension while adding
middleware to ASP.NET Core pipeline?
It is used for branching the pipeline. It branches the ASP.NET Core pipeline based on
request path matching. If request path starts with the given path, middleware on to
that branch will execute.
….
….
services.AddSession();
services.AddMvc();
….
….
app.UseSession();
….
….
What is Kestral?
Ans: Kestrel is a cross-platform web server for ASP.NET Core based on libuv,
a cross-platform asynchronous I/O library. Kestrel is the web server that is
included by default in ASP.NET Core new project templates. If your
application accepts requests only from an internal network, you can use
Kestrel by itself.
If you expose your application to the Internet, you must use IIS, Nginx, or
Apache as a reverse proxy server. A reverse proxy server receives HTTP
requests from the Internet and forwards them to Kestrel after some preliminary
handling. The most important reason for using a reverse proxy for edge
deployments (exposed to traffic from the Internet) is security. Kestrel is
relatively new and does not yet have a full complement of defenses against
attacks.