eInterviewQuestions

NetCore Interviews Questions

All our users, you can also add/post your question and answer which is mostly asked by an Interviewer in Interviews, you all can suggest for any changes to make our website best & user friendly. please feel free to Post Question.

Q1. What is .NET Core?

A cross-platform version of .NET, that supports supporting Windows, MacOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.

1. .NET Core and ASP.NET Core are FREE and Open Source.

2. .NET Core provides dotnet CLI – command line interface

3.  It is leaner, faster and improved version of .NET

4.  Main framework that Microsoft has been focusing on is .NET Core

5.  The .NET Core Runtime installation file is only about 20 MBs


Q2. What is ASP.NET Core?

ASP.NET Core 1.0 is the next version of ASP.NET. It is open source and cross-platform framework (supports for Windows, Mac and Linux) suitable for building cloud based internet connected applications like web apps, IoT apps and mobile apps. ASP.NET Core apps can run on .NET Core or on the full .NET Framework.

ASP.NET Core 2.0 is the latest version of ASP.NET.

It works with both .NET Core and .NET Framework.

ASP.NET Core is much cleaner and easier to work with. You only need to write 20~30 lines of code and you have the web server ready to run. It also works smoothly with your file system, so can just copy and paste files to your project folder. And no, you don’t need to reference these files from a .csproj file.

New features of 2.0

1. Razor Pages

2. DbContext Pooling with Entity Framework Core 2

3. Simplified Application Host Configuration

4. Configuration is now part of DI and ready for the time server reaches Startup class

5. Simplified authentication model

6. dotnet new now restore NuGet packages automatically

7. New meta package – Microsoft.AspNetCore.All

Main characterestics of ASP.NET Core:

1. There is no Global.asax – We have Startup.cs which is used to set up Middleware and services for DI Container.

2. There is no web.config. now we use appsettings.json file in combination with other sources of configuration (command line args, environment variables, etc.)

3. DI Container which is quite simple and built-in.

4. Built-in and extensible structured logging. 

5. Extensible strongly typed configuration, which can also be used to reload at run-time

6. Kestrel – new, cross-platform and super fast web server which can stand alone without IIS, Nginx or Apache

7. New, fully async pipeline. It is easily configured via middleware


Q3. What is Startup.cs file in ASP.NET Core?

In ASP.NET, Global.asax acts as the entry point for your application but Startup.cs  is the  entry point for .NetCore applications.


Q4. Can we use both ASP.NET Core work with the .NET framework?

Yes. We can use ASP.NET Core with .NET framework and this is officially supported by Microsoft.

ASP.NET Core works with

.NET Core framework

.NET framework


Q5. What is the purpose of ConfigureServices()?

ConfigService defines the services used by the application like ASP.NET core framwork, Entity Framwork, MemoryCaching , Loging, Connectionstrings, CORS etc.

public void ConfigureServices(IServiceCollection services)  

{

    services.Configure<AppSettings>(Configuration.GetSubKey("AppSettings"));

    services.AddEntityFramework()

            .AddSqlServer()

            .AddDbContext<SchoolContext>();

    // Add MVC services to the services container.

    services.AddMvc();

}


Q6. Where resides the static files in ASP.NET Core (MVC)?

All static files are now located inside of wwwroot folder. You store your CSS, JS, images, fonts and others static content inside of it.