What is ASP.NET Core?
The ASP.NET Core is a new open-source framework introduced by Microsoft. Originally it was called ASP.Net 5 but later renamed to ASP.Net Core and released the first version of ASP.Net Core in the year 2016. Next version i.e. ASP.Net Core 2.0 was released in the year 2017.
ASP.Net Core is a cross-platform open-source framework for building modern applications including cloud-based development.
ASP.Net Core is designed to support client-side frameworks like KnockoutJS, Angular JS and Bootstrap.
ASP.Net core has various architectural changes which make it a great framework for a developer. You can say it’s a new version of .net.
From .Net version 1.1 to .Net 4.6, there are numerous features which were added and yes those features have been used widely in industry. But there was a limitation with .Net framework.
An application developed in .Net framework can be hosted in a Windows environment only. Means .Net framework given by Microsoft can run within Windows OS given by Microsoft.
So, people from Linux or Mac background cannot utilize those .Net based applications.
To open this boundary Microsoft introduces its open-source framework and named it as .Net Core.
.Net Core provides a new way to develop an application and gives you the flexibility to develop an application in your favorite environment on your favorite tool.
You can say that .Net Core is a cross-platform implementation of .Net framework.
.Net Framework vs .Net Core
Before going ahead, we should know the differences between .Net Framework and .Net Core.
Below table explains the differences between these 2.
.Net Framework | .Net Core |
It is not an open source | .Net Core is an Open Source framework. It is maintained by Microsoft and Github .Net Community. |
It is OS-dependent and can target Windows OS only. | It is Platform independent. It means an application developed in .Net Core can run on Windows, Linux and Mac OS. |
We can develop ASP.Net Web Forms, Windows Forms, ASP.Net MVC, WPF, WCF applications using .Net Framework | We can develop a Universal App in .Net Core |
Advantages of ASP.Net Core?
- It is a framework to build web applications
- It is open source
- Deploy .Net core application to on-premises or to the cloud.
- Build and run the application on Windows, MAC, and Linux
- A cloud-ready environment
- Ability to host in IIS or self-host
- Use of Docker Containers
- Implements Microservice Architecture
ASP.Net core apps can run on cross-platform such as Windows, Mac, Linux. So how can someone choose between .Net core and ASP.Net Framework?
Go for .Net core, if :
1. You are developing a cross-platform application.
2. You are looking for high performance and scalable system.
Go for ASP.Net framework, if:
1. You are working on an environment that does not support .NET core.
2. NuGet packages not available for .NET Core.
.Net Core Tools
1. Visual Studio 2015/2017
2. Command Line Interface
How to start development with .Net Core in Visual Studio 2015?
If you are using VS 2017 you will get .Net Core in the installed template. And if you are using VS 2015 then you need Update 3 of VS 2015.
Follow below steps to update Visual Studio 2015 to start development with ASP.Net Core 1.0.1.
Open Visual Studio 2015. Tools ->Extensions and Update
You will see “Microsoft ASP.NET and Web Tools”, click on Update.
You will see Microsoft .NET Core 1.0.1 installer.
Install this tool.
Once installation was done, Open VS 2015
Go and create a new project, and you will see .NET Core in the template.
See below screen for more details. You can notice the message in the right side saying –
“Project templates for creating ASP.NET Core applications for Windows, Linux and OS X using .NET Core.”
Create a Web Application, and you will see below the welcome page.
.Net Core with Visual Studio 2017
If you are using Visual Studio 2017 then you do not need an update, you can start development with .Net Core in Visual Studio 2017.
Select your desired Project Template.
Once you create the project, solution explorer looks like this. It is quite similar to what we have seen in Visual Studio 2015.
Application Settings (appsettings.json)
Startup.cs
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } |
Configure() – This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(“/Error”); } app.UseStaticFiles(); app.UseMvc(); } |
Why .Net Core?
- The industry is moving towards Cloud and cloud-based development is in demand.
- Cross Platform compatibility
- Open Source Technology
Summary:
1. .Net Core is a framework to build web applications.
2. .Net Core is cross-platform
3. .Net Core is easy to implement Microservice Architecture
5. Till April, 2021 .NET 5 is the latest stable version and .NET 6 is about to release in Nov, 2021.
6. .Net Core is not the replacement of .Net
Next Blog – Introduction to .Net Core 2.0
Impressive blog with lovely information. Really a very useful article for us thanks for sharing such a wonderful blog.
https://espirittech.com/dot-net-application-development-company/