ASP.NET Core application can be run in .NET 4.7.2 environment? - asp.net

I built an ASP.NET Core application, but I have a hosting server which allows .NET 4.7.2 version only.
Is it possible to deploy to that environment?

As #marc_s already said that you cannot run .NET Core on .Net xxx
run time as two version has it's own runtime and they are different in
regards of its architecture.
If you have a .NET Core application, depending on its version, you could choose your runtime.
Here is the official release of all .NET Core versions:
Note
If you have any requirement where you need to communicate both .NET Core xxx version along with the Classic .NET xxx version, there is a way to build a bridge between them that is .NET Standard library.
The main goal behind .NET Standard was to establish greater uniformity in the .NET ecosystem. You can get more details in the official document here
Hope above explanation guided you accordingly.

Related

.NET Core 5.0 Console with WebAPI

I once build a .NET Core Console App that contained a web host, so I could make controllers without using IIS. Isn't that possible in 5.0?
I need it to run as a service later. It used to be so easy :-)
I can't find any guides to that, but I can find guids addressing version 2.1.
Latest .NET Core project templates (and .NET 5 ones) use Kestrel by default.
You can find the related documentation here.
You can also find here specific documentation about running ASP .NET Core as a service in both Windows and Linux, and in the case of Windows, with and without IIS.

Asp.Net Core 2.1 with .Net Framework 4.6.1 error after deployment using dotnet publish or visual studio publish

I am trying to deploy Asp.Net Core 2.1 application with target framework 4.6.1 on server. I am using dotnet publish command and copying the publish folder on the server where deployment is intended. Everything works fine on local machine. But when I am trying to run the application on the server , it is throwing the exception ".Net Framework 4.6.1 not installed, please install it.".
I thought .Net framework is not installed but when I checked installed software , I can see .Net 4.6.1 is installed. Not sure why the error is occurring.
Here is screenshot for the application error and installed software
That error is odd, since you do indeed seem to have that version installed. However, I believe it may be a red herring. I haven't personally tried to run ASP.NET Core 2.1 on .NET Framework, but I suspect it may not work at the moment. The full framework support depends on .NET Standard compatibility which only goes up to .NET Core 2.0. (With .NET Standard 2.0). ASP.NET Core requires .NET Core 2.1. You can try targeting a later version of .NET Framework - something recent like 4.7.2. You may need to downgrade to ASP.NET Core 2.0, if you need to target .NET Framework.
Your list only shows development packages to support targeting and developing for .NET Framework 4.6.1
See How to: Determine which .NET Framework versions are installed for ways to check the .NET Framework version on the machine.

.NET Core project add reference to .NET Framework project. Why it's possible?

I have followings projects:
.NET Core 2.0 Web Application
.NET Standard 2.0 Class library &
.NET Framework 4.5 Class Library.
I add reference of .net framework class library to asp.net core web api project. and it seems it works very well.
I am wondering why it's possible to add reference of .NET Framework class library project to ASP.NET Core Web API or MVC?
It's not supposed to allow adding only Standard or Core libraries references to Core projects?
Is this core Web project with .NET Framework class libraries references still cross platform?
UPDATE
According to Phiter comment:
"If you import a .net framework library to your project it'll no longer be cross platform, but you can do it freely if you want to. They allow it because you might want to use .net core and still be on windows."
So if this is a reason, if I want to bind my project to .NET Framework and remain on windows why I use Core Web Project from the first place?
I thought we use core projects for cross platform ability and if not, the .Net framework is not a better option?
UPDATE
mason comment:
"Nothing funny: ASP.NET Core project doesn't have to run on .NET Core. It can also be run on .NET Framework.
Just because it's called 'Core' doesn't mean they're related. They could have called it ASP.NET FancyPants and had it run on .NET Core and .NET Framework and you wouldn't be as confused. Microsoft just sucks at naming things."
UPDATE (November 12, 2018)
A first look at changes coming in ASP.NET Core 3.0 - Fully leveraging .NET Core
As announced on the .NET Blog earlier this month, .NET Framework will get fewer of the newer platform and language features that come to .NET Core moving forward, due to the in-place update nature of .NET Framework and the desire to limit changes there that might break existing applications. To ensure ASP.NET Core can fully leverage the improvements coming to .NET Core moving forward, ASP.NET Core will only run on .NET Core starting from 3.0. Moving forward, you can simply think of ASP.NET Core as being part of .NET Core.
Customers utilizing ASP.NET Core on .NET Framework today can continue to do so in a fully supported fashion using the 2.1 LTS release. Support and servicing for 2.1 will continue until at least August 21, 2021 (3 years after its declaration as an LTS release) in accordance with the .NET Core support policy.
This was just added as part of .NET Standard/Core 2.0. As long as the .NET Framework dll only references things in the .NET Standard, it will use type forwarding to the .NET Core implementations.
I do not know what made Microsoft allow referencing .net framework class library into .net core project but as a programmer, I am happy with this allowance.
You see allowing .net core application to reference .net framework libraries is useful in case you want to start with windows and are planning to go cross platform in the future.
We are in a stage where many useful open source libraries do not fully support .net core till the date of this post, masstransit is an example, so when I am developing a new software I will be using .net core project that depends on such libraries and I will update them later when they support .net core.

Difference between asp.net core projects in Visual Studio

In Visual Studio we can create three types of project templates:
ASP.NET Web Application
ASP.NET Core Web Application (.NET Core)
ASP.NET Core Web Application (.NET Framework)
Based on the question and answer found here:
Visual Studio 2015 Web Application .NET Core vs .NET Framework
I understand that when using first option I always will be hosting my app on Windows. The same happens when I pick option 3. For the second option I can host my app on Windows, Mac or Linux. I still don't understand why option 2 and three are both called Core Web Application if for the third option I will be using .net framework. What is the difference between option 1 and 3? Both will use .net framework and both can be hosted only on Windows so why the third option is called Core?
It's all about the runtime
The first option is ASP.NET (Full, legacy, whatever you want to call it) running on the .net 4.x runtime.
The second option is ASP.NET Core (a reduced set of common functions that work on all platforms) running on .NET Core Runtime.
The third option is ASP.NET Core running on .NET 4.x runtime. This option is there so that you can write .NET Core applications today, even though you may need functionality that is only available on .net 4.x (ie, you have legacy libraries that have not been ported to .net core, or that cannot run on .net core)
In the third case, you may at a later time convert to a full core application when the dependencies become core, or when the .net core framework matures to include the functionality you need.

What's the difference between ASP.NET 5, .NET Core, and ASP.NET Core 5? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I'm confused on the distinction between these terms:
ASP.NET 5 (now renamed ASP.NET Core and released as 1.0, not 5.0)
ASP.NET Core 5
.NET Core
Can anyone briefly explain it?
ASP.NET 5 (now ASP.NET Core 1.0)
Is the next generation of ASP.NET that provides a familiar and modern framework for web and cloud scenarios. It includes the next versions of ASP.NET MVC, Web API, Web Pages and SignalR. It is a high-performance and modular design, and supports full side by side to make it seamless to migrate from on premise to the cloud. These products are actively developed by the ASP.NET team in collaboration with a community of open source developers. Together we are dedicated to creating the best possible platform for web development.
Update: It has been renamed from ASP.NET 5 to ASP.Net Core 1.0.
.NET Core:
.NET Core is the small optimized runtime that is the basis of ASP.NET Core. It currently runs on Windows, Linux, and Mac. It is a high-performance and modular design, and supports having several applications on a web server each one with its own copy of the .NET Core runtime, enabling a full side by side experience, and that will make it easy to adopt new .NET Core versions without affecting other apps, and this makes .NET Core architecture a leap forward from the current classic .NET 4.6. These products are actively developed by the .NET team and in collaboration with a community of open source developers. Together we are dedicated to improving and extending the .NET platform with new features and for new scenarios.
.NET Core has two major components. It includes a small runtime that is built from the same codebase as the .NET Framework CLR. The .NET Core runtime includes the same GC and JIT (RyuJIT), but doesn’t include features like Application Domains or Code Access Security. The runtime is delivered on NuGet, via the Microsoft.CoreCLR package.
.NET Core also includes the base class libraries. These libraries are largely the same code as the .NET Framework class libraries, but have been factored (removal of dependencies) to enable us to ship a smaller set of libraries. These libraries are shipped as System.* NuGet packages on NuGet.org.
For more information, see Introducing .NET Core
ASP.NET 5 is a new platform based on DNX (.NET Execution Environment). DNX is on duty for loading CLR. There're two kind of DNX now: for Full .NET CLR (from .NET Framework) and for CoreCLR. CoreCLR is a new cross-platform light CLR (runs on Win/Linux/Mac).
ASP.NET 5 works seamlessly on CLR/CoreCLR as DNX abstracts it from runtime being used.
IL assemblies build for old .NET still be used with new CoreCLR and DNX. So ASP.NET 5 functionality is a bunch of nuget packages.
Strictly speaking there're no such things as "asp.net core 5" and ".net core" now (as CLR != .NET). There's "ASP.NET 5 running on CoreCLR".
IMO it's better to consider "ASP.NET 5" as ".NET 5".
There is no ASP.net Core 5 yet. In fact, Microsoft decided to change the .net 5 (The version after 4.6) to a brand new name : .net Core
So the version released on June 2016 is actually .net Core 1.0
The reason why they gave it a new name is the very fundamental change they've made in it.
These fundamental changes include :
Cross platform: It works on Windows/Linux/Mac as opposed to the previous versions working only on Windows/IIS
It's fully open source now and you can see every bit of its code in GitHub.
Its performance (especially in ASP.net) is way better than the previous versions, as you can easily customize your request pipeline according to what you need (through middlewares).If you are familiar with nodejs and ExpressJs framework it's so similar to ExpressJs. In some cases it performs better than NodeJs. Have a look into this benchmark.
It's designed with a modern mindset of app development, for highly distributed cloud applications, microservices and containers (docker)
ASP.NET Core is the next version of ASP.NET MVC 5, Yes, the version number is confusing! It has gone through a few name changes. It started as ASP.NET vNext, then changed to ASP.NET 5, next was renamed to ASP.NET MVC 6 and eventually became ASP.NET Core 1.0.
The main difference between ASP.NET and ASP.NET Core are
Platform Independent Features, ASP.NET Core provides hosting in multiple platform (Win / Linux / Mac OS) hosting (Cross platform).
Introduced new lighter version of CLR and assemblies with non-dependent frameworks.
Frameworks are a complete rewrite (removal of dependencies with DI) and Its Open source Project.
Project default project template is updated with Type scripts insted of JQuery.
Improved new security features and completely decoupling for all its dependent framework.
Updated project template with angular and json based configuration & enhanced packages support with node modules.
Supports for Visual Studio IDE ( 2015 v3 + 2017 and above) & VS Code IDE.
If you are new to this, Please refer Here
By the way there is also a Mono runtime as an alternative to CoreCLR in the linux apt and Docker package. Mono is still the default when it's up to installing DNX. The whole thing about the "Core" is that it's a cross platform .net framework and at some point hosting an ASP.NET 5 app will not make use of IIS, Apache, Mono etc., but the DNX and Libuv.
.NET Core 1.0 is not the next version of .NET 4.6.2 (Full .NET Framework). If it is the next version it should have more features than the previous version. But according to Microsoft .NET Core 1.0 doesn't have some of the features .NET 4.6 got. That's why they named it as .NET Core 1.0 instead of .NET 5.
In ASP.NET Core 1.0 they are using .NET Core 1.0 as reference. That means we don't need to install .NET framework to run our ASP.NET Core 1.0 application.
You can find more updated information here.
ASP.NET Core i.e 1.0/2.0...
ASP.NET Core is an open-source, cross-platform framework for building modern, cloud-based web apps on Windows, macOS, or Linux.
ASP.NET i.e ...4.5/4.6
ASP.NET is a mature framework that provides all the services needed to build enterprise-grade, server-based web apps on Windows.
There is no such thing as ASP.NET Core 5 and .NET Core.
ASP.NET 5 is same as ASP.NET Core 1.0
Please refer to the link:
https://learn.microsoft.com/en-us/aspnet/core/choose-aspnet-framework?view=aspnetcore-2.0

Resources