Search code examples
c#iisasp.net-web-api.net-5filenotfoundexception

FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, Version=5.0.0.0 on IIS


I'm working on a microservices project based on .net 5 and recently add API versioning to the gateway endpoint (using Microsoft.AspNetCore.Mvc.Versioning and Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer). API Versioning is working on my local machine but after deploying my project on IIS, I ran into the following error:

FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

FileNotFoundException

Let me know if you have the solution


Solution

  • You should add Microsoft.AspNetCore.Mvc.Versioning and Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer on Web.Medario.HttpAggregator.deps.json file existing in publish output files.