DotNetCore 2.2 App with IIS not working - HTTP Error 500.0 - ANCM In-Process Handler Load Failure - asp.net-core

I have a DotNet Core 2.2 application that I am trying to get running through IIS. However, I get the following error: HTTP Error 500.0 - ANCM In-Process Handler Load Failure when I try to load the app in my browser.
Upon checking the logs it says the following:
Error:
An assembly specified in the application dependencies manifest (blablabla.deps.json) was not found:
package: 'AutoMapper.Extensions.Microsoft.DependencyInjection', version: '7.0.0'
path: 'lib/netstandard2.0/AutoMapper.Extensions.Microsoft.DependencyInjection.dll'
But I think that's a bit of a red herring.
The following is the output from dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 2.2.401
Commit: 729b316c13
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.401\
Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51
.NET Core SDKs installed:
2.2.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I have tried all of the following:
Changed "AspNetCoreModuleV2" to "AspNetCoreModule" in the
Web.config.
Tried switching AspNetCoreHostingModel=InProcess to
RuntimeFrameworkName=Microsoft.AspNetCore.App in my Web.csproj file.
Cleaning and manually deleting the bin, obj, and .vs folders
My application pool is set to 'No Managed Code' (as the guides all say). At a bit of a loss regarding what to do as I've been through every forum post and github issue on the matter. Also, it is running on my colleagues machine whom has the exact same configuration as me.
One thing to note though, if he creates a copy of his application pool (same settings, basic and advanced, just a different name), and tries to run it on that, it doesn't work either and he gets the same error as me. It only works on the application pool called 'Core AppPool' which was automatically added to IIS upon installation of windows server hosting or the SDK (not sure which).

It seems your application pool identity don't have the enough permission to access your package folder.
I suggest you could try to set the package folder with enough permission by setting the folder's security.

Related

How to fix dotnet ef tool, .NET Location not found

I created a .net core 7 project using the entity framework core. Well, at that time I installed .net core 6 so my global ef tool was still version 6, then I updated to version 7. Here I had a problem, it said that I had not installed the framework. I decide to uninstall dotnet. Then I reinstalled sdk 7 and global ef tools. And new error appear. I try reinstall many times. But still like this, now I can't use the ef tool.
This is dotnet --info
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/share/dotnet/sdk/7.0.101/
Host:
Version: 7.0.1
Architecture: x64
Commit: 97203d38ba
.NET SDKs installed:
7.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/lib/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
And this is the error,
You must install .NET to run this application.
App: /home/apriza/.dotnet/tools/dotnet-ef
Architecture: x64
App host version: 7.0.1
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=7.0.1
I found my answer, I change the Root dotnet env which in /usr/share/dotnet for dotnet 7.
Run export DOTNET_ROOT=/usr/share/dotnet

After moving .NET Core 2.2 web application to new computer with Windows 10, it fails

After moving the application I get this error. I have downloaded and installed SDK 3.1.302 and runtime 3.1.6 but I get this error:
HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Specific error detected by ANCM:
It was not possible to find any compatible framework version The framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found. - The following frameworks were found: 2.1.20 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] 3.1.6 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] You can resolve the problem by installing the specified framework and/or SDK. The specified framework can be found at: - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=2.2.0&arch=x64&rid=win10-x64
On the SDK .net core download page it says 2.2 is no longer supported and so I downloaded. 3.1.302 as recommended.
However, I think I need to find somewhere in my VS 2019 for that solution and change it to 3.1.6 runtime from 2.2 but I have no idea where that would be.
I looked on the web for a solution but could not find one. I found a mention of removing this
environment variable but that didn't work.
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
Where is my app referencing .net core 2.2? It worked so well on Windows 7 Visual Studio 2017 that I moved it from.
Under project csproj file configuration you have something like <RuntimeFrameworkVersion>2.2</RuntimeFrameworkVersion> or <TargetFramework>netcoreapp2.2</TargetFramework> or <PackageReference Include="Microsoft.AspNetCore.All" Version="2.2" />?
And 2.2 is no longer supported you need back to 2.1 or 3.x. I suggest you to upgrade project to latest version if is it possible.
or you can still download the SDK 2.2 from archive.
https://dotnet.microsoft.com/download/dotnet-core
Installing .Net Core 3.1 does not install the older runtimes by default. You will need to install 2.2, or when you publish your program, publish it as "Self-contained" which should include everything needed to run it.
While 2.2 has been EOLed, you can still run your .net core 2.2 program. You can download the last 2.2 runtime here: https://dotnet.microsoft.com/download/dotnet-core/2.2
You will likely want the Windows Hosting Bundle.
Install that, and once it's complete, you can check your runtime version from powershell with dotnet --list-runtimes
You should see a list of installed runtimes come up. You will want to see something like: Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
With that you should be able to run the application.
That being said, I would also recommend updating to 3.1 as soon as possible.

dotnet command not working on centos server, runtime installed

I installed aspnet core runtime (aspnetcore-runtime-3.1.3) on a centOS 7 server.
following this guide from microsoft documentation: https://learn.microsoft.com/en-us/dotnet/core/install/runtime?pivots=os-linux#download-and-manually-install
my server doesn't have internet connection.
After installation, when I run any command, e.g.
dotnet --info
it says it can't find any installed dotnet sdk:
$ dotnet --info
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/home/myuser/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.3 [/home/myuser/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Previously, I downloaded the rpm package and installed it with rpm -ivh command, same result
What can I do to fix this?
Note that I don't have internet access in the server
EDIT: The problem: I don't need SDK to run this command or any command I am using.
Anyways I've tried installing SDK, it says it can't find any compatible frameworks
What is the problem? you just installed runtime, and the error says there is no sdk.
You installed the .net runtime but didn't install the any sdk. for you to be able use asp.net core you need to install both. you can visit asp.net core documentation for the difference between them. but you can just visit https://dotnet.microsoft.com/download to download the appropriate sdk you need.
nb: I assume you are doing this from a gui. i'm sure there are commands for installing the asp.net core runtime and SDK from command prompt. but what is important is that YOU ARE MISSING THE SDK!!

Nuget for Microsoft.NETCore.App 3.0.0 not available?

We are facing memory leak with ConfigurationRoot. Looking at this thread, it's now been fixed:
https://github.com/aspnet/Extensions/issues/861
This requires us to upgrade to Microsoft.NETCore.App 3.0.0
https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Abstractions/
But, I am not able to locate Microsoft.NETCore.App 3.0.0 nuget anywhere. Any idea where I can find this?
Microsoft.NETCore.App is a metapackage, which references all commonly used library for an .NET Core application. Install a new .NET SDK Runtime on the target system.
The version will still be 3.0.0, but when you run the application it will roll-forward to the newest patch version.
If its an self-contained application (vs. portable application which requires a .NET Core runtime installed on target system), then update the SDK on the build system and recompile your application to cause build system putting the latest .NET Core artefacts in the publish directory.

The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found

I tried to upgrade my web app from .net core 2.0 to .net core 2.1
I did:
1) Install Visual Studio Professional 2017 Preview Version 15.8.0 Preview 1.1
2) Installed the .net core 2.1.3 RC1 SDK from here: https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1
3) Updated all of my aspnetcore nuget packages to the latest version.
After doing both of these things, when I start my project I get this screen:
HTTP Error 502.5 - Process Failure Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit:
https://go.microsoft.com/fwlink/?LinkID=808681
and in my Output window from ASP.NET Core Web Server, I get this:
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\
- Installing .NET Core prerequisites might help resolve this problem:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
- The following versions are installed:
2.1.0-preview2-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.1.0-rc1-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\
- Installing .NET Core prerequisites might help resolve this problem:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
- The following versions are installed:
2.1.0-preview2-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.1.0-rc1-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
.NET Core 2.1 SDK will be released this week. If you can't wait until then, add this to your *.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RestoreAdditionalProjectSources>
https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180515-07/final/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>
....
</Project>
And download the final SDK from: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300/dotnet-sdk-2.1.300-win-x64.exe
For more details visit: https://github.com/aspnet/Home/wiki/2.1.0-Early-Access-Downloads
By updating all NuGet packages, you seem to have upgraded from the RC version you started out with (which is installed on your system) to the RTM version currently being released (and thus already available on NuGet but not installed on your system).
The Microsoft.AspNetCore.App NuGet packages are supposed to be referenced without a version so that the installed tooling can pick an appropriate version.
Update your .csproj file to remove the Version attribute and only reference that package through:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
.NET Core SDK 2.1.300 is now available: https://www.microsoft.com/net/download/windows Install it, this fixed the problem for me.
Looks like it's available on chocolatey now https://chocolatey.org/packages/dotnetcore-sdk/2.1.300
Not yet on the normal dotnet distribution sites. Crazy.
uninstall previous version
Download and install version 2.1 sdk
After the whole process reboot your PC
It should work.
I opened the Visual Studio installer, went to Individual Components, selected .NET Core 2.1 Runtime (LTS), and installed it.
Solved my problem.