Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why run ASP.NET Core on .NET Core over .NET on Windows Server

Ever since I heard about ASP.NET Core and .NET Core I have been wondering why you would want to develop an ASP.NET Core web application running on .NET Core over .NET if you are running a Windows server, like Windows Server 2012? I can understand that if you are developing for cross platform for something else like Ubuntu but if you are running a Windows server why would you want to develop going the .NET Core route?

What are the benefits (if any)? I feel like I am missing something here? Is it the ideal way to do ASP.NET web development and deployment going forward? When would you want to use the full .NET framework for ASP.NET web development instead of the .NET Core framework?

Not everyone is developing for cross platform? I have been developing for Windows servers all my life and have never needed to do anything cross platform. I don't think I will ever develop anything cross platform using .NET - I'll probably use something other than .NET (if I ever go this route).

I hope that someone can help clarify my confusion?

like image 716
Brendan Vogt Avatar asked Jun 30 '16 12:06

Brendan Vogt


2 Answers

.NET Core

ASP.NET can run on .NET Core or on the full .NET Framework. The .NET Framework runs on Windows only and uses the full footprint of the .NET framework.

You can still use the full .NET framework, if you don't need the following:

.NET Core is host/ OS agnostic

You can run your apps on different OS's and hosts:

  • Linux, Windows, MAC
  • IIS, Console app, ..

and can be used in device, cloud, and embedded/IoT scenarios.

Modularity

.NET Core is a modular runtime and library implementation that includes a subset of the .NET Framework.

Means, you may install only the needed packages via nuget.

Portability:

You can package and deploy the CoreCLR with your application, eliminating your application’s dependency on an installed version of .NET (e.g. .NET Framework on Windows). You can host multiple applications side-by-side using different versions of the CoreCLR, and upgrade them individually, rather than being forced to upgrade all of them simultaneously.

Reduced Footprint

By factoring the CoreFX libraries and allowing individual applications to pull in only those parts of CoreFX they require (a so-called “pay-for-play” model), server-based applications built with ASP.NET can minimize their dependencies.

App-models

.NET Core does not support all the .NET Framework app-models, in part because many of them are built on Windows technologies, such as WPF (built on top of DirectX). The console and ASP.NET Core app-models are supported by both .NET Core and .NET Framework.

APIs

.NET Core contains many of the same, but fewer, APIs as the .NET Framework, and with a different factoring (assembly names are different; type shape differs in key cases). These differences currently typically require changes to port source to .NET Core. .NET Core implements the .NET Standard Library API, which will grow to include more of the .NET Framework BCL API over time.

Subsystems

.NET Core implements a subset of the subsystems in the .NET Framework, with the goal of a simpler implementation and programming model. For example, Code Access Security (CAS) is not supported, while reflection is supported.

Patches/Updates:

This, in turn, reduces the frequency with which patches and updates to the framework will impact these applications, since only changes made to the individual pieces of CoreFX leveraged by the application will impact the application.

Deployment:

A smaller deployment size for the application is a side benefit, and one that makes more of a difference if many applications are deployed side-by-side on a given server. Can be included in your app or installed side-by-side user- or machine-wide.

Open Source:

The .NET Core platform is open source, using MIT and Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET Foundation project. .NET Core is open source, while a read-only subset of the .NET Framework is open source.

enter image description here

like image 112
Legends Avatar answered Sep 30 '22 15:09

Legends


Running ASP.NET Core on the Full frameworks works great if you are running on Windows and in fact that's the approach I have chosen for porting my old Web Forms Applications. If you don't need cross platform support, I think ASP.NET Core on the full framework is a great option.

The .NET Core Framework is not nearly as full featured as the Full Framework and it can be much harder to port a legacy application to it. For example it doesn't support image manipulation currently.

But one of the great benefits of targeting the .NET Core Framework besides the fact that it's cross platform is that it has a much smaller footprint than the Full Framework and it can be deployed via file copy with your application. This means that the destination server does not need to have a .Net framework installed before deployment in order to run your code. This can be helpful in some cloud hosting situations where you don't have control over server level installs, and can be helpful when deploying to constrained environments like IoT devices.

That said, I suspect that there will be lots of ASP.NET Core application written to support the Full Framework. In some ways it's a beautiful pairing. On the one hand you get the super lightweight and fast ASP.NET Core web platform with Tag Helpers and all that goodness, and on the other hand you still have access on Windows to a full featured Framework that so many .Net developers know and love.

like image 22
RonC Avatar answered Sep 30 '22 15:09

RonC