ASP.NET Core is the free & open-source framework developed by Microsoft. It is faster than ASP.NET. ASP.NET is cross-platform - supports Windows, Linux and Mac. ASP.NET Core works with both .NET Framework & .NET Core.
#1.
How does a .NET Core app start?
ASP.NET Core web application is basically a console application which starts executing from the entry point public static void Main()
in Program
class where we can create a host for the web application.
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
Let's see below steps to understand how a .NET Core or ASP.NET Core application starts:
WebHost
, while non-web based apps require a GenericHost
.#2.
What is Host Builder?
A host builder is an instance of either HostBuilder
orWebHostBuilder
class.
For ASP.NET Core (HTTP Based workloads)
IWebHostBuilder
can be received from CreateWebHostBuilder
method#3.
Difference between .NET Core SDK and .NET Core runtime?
A runtime is the set of components that must be installed on a machine to run a framework-dependent app on the machine.
The .NET Core runtime includes the CoreCLR and the .NET Core base class library (earlier known as CoreFX).
For example:
The SDK includes everything you need to build and run .NET apps. It includes the following:
#4.
How would you host the .NET Core app on IIS?
To host an ASP.NET Core on IIS on Windows OS, you should download and install ASP.NET Core Hosting Bundle.
ASP.NET Core Hosting Bundle contains everything you need to run existing web/server apps. The bundle includes :
ASP.NET Core IIS Module allows ASP.NET Core apps to run behind IIS.
#5.
Explain different ways to host a .NET Core Web Application?
#6.
IServiceProvider vs IServiceCollection
#7.
Difference between Configure
and ConfigureServices
methods. Which one is optional?
#8.
How to set the hosting environment in ASP.NET Core?
#9.
In-process hosting vs Out process hosting in .NET Core?
#10.
Explain usage of UseStaticFiles()
and UseDefaultFiles()
methods in .NET Core?
#11.
app.Use()
vs app.Run()
vs app.Map()
vs vs app.MapWhen()
#12.
Difference between HTTP Handler and HTTP Modules?
#13.
How would you implement the HTTP Module in .NET Core?
#14.
How would you implement the HTTP Handler in .NET Core?
#15.
Name a few built-in HTTP Modules?
Here are a few built-in HTTP modules: - FormsAuthentication - SessionStateModules - HttpCacheModule
#16.
What is Configuration Provider in .NET Core?
#17.
Difference between AddScoped()
, AddTransient()
and AddSingleton()
methods?