Asp.Net Core Top questions

Find by name:


New Post

Recent Post

  • Peter Agyekum What is .NET Core?

    NET Core is a newer version of .NET, which is cross-platform, supporting Windows, MacOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.

    Peter Agyekum What are some of the features of .Net Core?

    Flexible deployment: Can be included in your app or installed side-by-side user or machine-wide. Cross-platform: Runs on Windows, MacOS and Linux; can be ported to other OSes. The supported Operating Systems (OS), CPUs and application scenarios will grow over time, provided by Microsoft, other companies, and individuals. Command-line tools: All product scenarios can be exercised at the command-line. Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.

    Peter Agyekum Why Use ASP.NET Core for Web Application Development?

    Ans: ASP.NET Core is a robust, and feature-rich framework that provides features to develop super-fast APIs for web apps. Cross-platform: Runs on Windows, macOS, and Linux; can be ported to other OSes. The supported Operating Systems (OS), CPUs, and application scenarios will grow over time, provided by Microsoft, other companies, and individuals. Flexible deployment: Can be included in your app or installed side-by-side user or machine-wide. Runs on IIS or can be self-hosted in your own process. Built-in support for dependency injection. ASP.NET Core is cloud-ready and has improved support for cloud deployment. Provides Support for Popular JavaScript Frameworks. Unification Of Development Models which allows the MVC and Web API development models to use the same base class Controller. Razor Pages makes coding page-focused scenarios easier and more productive. Environment based configuration supported for cloud deployment. Built-in logging support. In ASP.NET we had modules and handlers to deal with requests. In ASP.NET Core we have middleware which provides more control over how the request should be processed as they are executed in the order in which they are added.

    Peter Agyekum What is Startup.cs file in ASP.NET Core?

    Startup.cs, it is entry point for application itself. The Startup class configures the request pipeline that handles all requests made to the application.

    Peter Agyekum What ConfigureServices() method does in Startup.cs?

    This method is optional. It is the place to add services required by the application. For example, if you wish to use Entity Framework in your application then you can add in this method.

    Peter Agyekum What is Kestral?

    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.

    Peter Agyekum What is WebListener?

    SP.NET Core ships two server implementations Kestral and WebListener. WebListener is also a web server for ASP.NET Core that runs only on Windows. It’s built on the Http.Sys kernel mode driver. WebListener is an alternative to Kestrel that can be used for direct connection to the Internet without relying on IIS as a reverse proxy server.

    Peter Agyekum What is a Host and what’s the importance of Host in ASP.NET Core application?

    Ans: ASP.NET Core apps require a host in which to execute. The host is responsible for application startup and lifetime management. Other responsibility of host’s includes ensuring the application’s services and the server are available and properly configured. Don’t confuse yourself with a Server. The host is responsible for starting the app and its management, where the server is responsible for accepting HTTP requests. The host is configured to use a particular server; the server is unaware of its host.

    Peter Agyekum How to handle 404 error in ASP.NET Core 1.0

    I found 2 ways to handle 404 error. In fact using these solution you can handle any HTTP status code errors. To handle the error, both the solution are using configure() method of Startup.cs class

    Peter Agyekum What is the use of UseIISIntegration?

    Ans: This tells ASP.NET that IIS will be working as a reverse proxy in front of Kestrel. As if you expose your application to the Internet, you must use IIS, Nginx, or Apache as a reverse proxy server. When you wish to deploy your ASP.NET Core application on windows, you need to tell ASP.NET Core Host to use IIS integration. UseKestrel and UseIISIntegration must be used in conjunction as UseKestrel creates the web server and hosts the code. UseIISIntegration specifies IIS as the reverse proxy server.

    Peter Agyekum What are the different ways for bundling and minification in ASP.NET Core?

    Ans: There are different ways for doing bundling and minification in ASP.NET Core. Gulp – was the default choice for ASP.NET Core till beta versions. Later it was removed due to performance and speed issue and replaced with BundlerMinifier. Read this post to find out the reasons of this decision. BundlerMinifier – is a Visual Studio extension and it’s default choice now. You should see bundleconfig.json file in your default template. Read this post to know more about bundling and minification in ASP.NET Core. ASP.NET Core Web Optimizer – ASP.NET Core middleware for bundling and minification of CSS and JavaScript files at runtime. Grunt – can also be used with ASP.NET Core. For more Read Overview of Tools for bundling and minification in ASP.NET Core.

    Peter Agyekum What is wwwroot folder in ASP.NET Core?

    In ASP.NET Core, all the static resources, such as CSS, JavaScript, and image files are kept under the wwwroot folder (default). You can also change the name of this folder.

    Peter Agyekum What is AspNetCore Middleware?

    Middleware is software that's assembled into an app pipeline to handle HTTPs requests and responses. Such as Cors

    Peter Agyekum What is Static files in ASP.NET Core?

    Static files are stored within the project's wwwroot directory and Startup.Configure enables static files to be served.

    Peter Agyekum What is AspNetCore EndPoint?

    Endpoint routing is enables you to provide routing information such as HTTPs to middleware by matching the request (URL) processing pipeline.

    Peter Agyekum What is host in AspNetCore?

    ASP.NET Core apps configure and launch a host. The host is responsible for app startup and lifetime management. Host configures a server and a request processing pipeline. The host can also set up logging, dependency injection, and configuration.

    Peter Agyekum What does CreateDefaultBuilder in program.cs in Asp.netCore?

    It Configures Kestrel server as the web server using the app's hosting configuration providers. CreateDefaultBuilder enables IIS Integration, which configures the app's base address and port. IIS Integration also configures the app to capture startup errors.

    Peter Agyekum What is Kestrel?

    Kestrel is an open source, cross platform, light weight and a default webserver used for Asp.Net Core applications. Asp.Net Core applications run Kestrel webserver as in-process server to handle web request.

    Peter Agyekum What is the difference between synchronous postback and asynchronous postback?

    The difference between synchronous and asynchronous postback is as follows: - Asynchronous postback renders only the part of the page which is needed; while, synchronous postback renders the entire page in a postback. - Asynchronous postback executes only one postback at a time, that is, if you have two buttons doing asynchronous postback, the actions are executed one by one; while, - synchronous postback invoke all the actions at a time. - Asynchronous postback only changes the update panel that invoke the postback; while, synchronous postback changes the entire page.

    Peter Agyekum Can you explain Service Lifetime in AspNet Core?

    Built-in IoC container manages the lifetime of a registered service type. It automatically disposes a service instance based on the specified lifetime. The built-in IoC container supports three kinds of lifetimes: Singleton: IoC container will create and share a single instance of a service throughout the application's lifetime. Transient: The IoC container will create a new instance of the specified service type every time you ask for it. Scoped: IoC container will create an instance of the specified service type once per request and will be shared in a single request.