I have a .NET core 2.2 application which I'm trying to publish to my web hosting but I'm getting a "500 - Internal Server Error" as a result.
I contacted support and they located the problem as being the following:
We enabled detailed error for your website and it is showing "Handler >"aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list". It seems that you are using Microsoft.AspNetCore.App 2.2.1 for your website application and this version is not installed on the server. Due to this website is not working.
On the server Microsoft.NETCore.App 2.2.1 is installed. So we would suggest you to re-deploy the application using .NetCore 2.2.1 and again check the website.
We only support .Net core runtimes installed on our shared hosting server. Re-deploy your application using the correct version to avoid any further issues. Please note that we do not support SCD (Self Contain Deployed application) on our shared server. We do support FDD (Framework Dependent Deployed application) only.
If I do a "dotnet --info" I can see that both .NETCore.App and AspNetCore.App are installed on my machine.
.NET Core SDKs installed: 2.2.103 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.1 [C:\Program > Files\dotnet\shared\Microsoft.NETCore.App]
My .csproj is referencing Microsoft.AspNetCore.App but it seems I cannot change this to Microsoft.NETCore.App.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.1"/>
</ItemGroup>
</Project>
Is there any way I can deploy this app to use Microsoft.NETCore.App so it works on the server?