4
votes

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.AspNetCore.Hosting.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

I am using aws to deploy my project to server(.NetCore 3.1). I am getting above error.But in local iis working fine.

I tried to install 'Microsoft.AspNetCore.Hosting.Abstractions'. But still I am facing same issue.

Please find below for package reference

 <Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="EPPlus" Version="5.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.5" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="4.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
    <PackageReference Include="MongoDB.Driver" Version="2.10.3" />
    <PackageReference Include="Nancy" Version="2.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
    
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Helpers\Helpers.csproj" />
    <ProjectReference Include="..\Models\Models.csproj" />
    <ProjectReference Include="..\Repository\Repository.csproj" />
    <ProjectReference Include="..\Services\Services.csproj" />
  </ItemGroup>


</Project>

I have gone through few link regarding same error. I tried all the method. But still i am getting same issue.

1
Guys someone please help me outAravindhan R
Have you installed the latest webhosting bundle in AWS?Jokies Ding
@JokiesDing I am not sure because i am not handling this server. But i extracted the dll then i came to know in server there is no latest version of 'Microsoft.AspNetCore.Hosting.Abstractions' (Assembly Microsoft.AspNetCore.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) but in my local (Assembly Microsoft.AspNetCore.Hosting.Abstractions, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60). Hopefully i am thinking that there is no latest version is present in serverAravindhan R
It sounds like the .net core version on AWS is .net core 2.2. So have you installed 3.1 and hosting bundle on that AWS server?Jokies Ding
Yes in server 3.1 is present.Aravindhan R

1 Answers

0
votes

This could be similar to this issue (different file) https://docs.microsoft.com/en-us/answers/questions/8017/aspnet-core-310-site-wont-run-could-not-load-micro.html

could you please verify all the .Net core related packages in all the projects? Also, if you can post the package reference from all your projects, it will be easy to verify.

The issue could be due to one or more packages in any of your projects. Also, make sure the correct version of SDK is available in AWS. Try an empty app with the same project setup (same packages in all the 5 projects with lower package version ) and deploy this to AWS to find out the issue.