0

I'm using Asp.Net Web API framework by developing API'S in visual studio 2019. Project is building and easily execute at my local machine and i can test the API's as well. But when i publish the code on my shared server, and run the URL, http://foneme.dewy.com.pk/, this is giving an error, states

"Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

Hi, can you tell me the solution how i can resolve this issue. (Thanks)

Amin Golmahalleh
  • 3,585
  • 2
  • 23
  • 36

1 Answers1

1

I got this after updating my ASP.NET project from .NET 4.7.1 to 4.7.2. I used half a day searching for a solution. Some suggested to change (or add) the binding redirect in Web.Config.

I solved it by REMOVING the binding instead, in all projects using this in the solution. The binding worked in .NET 4.7.1, but seemed to be giving errors after upgrading.

Mats Magnem
  • 1,375
  • 1
  • 10
  • 21
  • Hi, Thanks for your response, i'm using already .Net 4.7.2, this is working at local but creating problem at live server – Ali Baba Jan 05 '20 at 16:20
  • What kind of server? A VM or with accessible OS or a cloud SaaS? – Mats Magnem Jan 05 '20 at 16:40
  • This is shared windows hosting server, this is the link http://foneme.dewy.com.pk/ – Ali Baba Jan 05 '20 at 16:48
  • Are you referencing System.Net.Http from NuGet or from system reference? If NuGet, try to force reinstall all NuGets on all projects in solution from Packet Manager console by using Update-Package -reinstall, delete "obj" folder and rebuild your solution. Check for errors during this process. – Mats Magnem Jan 05 '20 at 17:47
  • Hi,Thanks for your response,i found the problem , actually the server does not support the .Net framework version that i was using for web API's project. I change the .Net framework version, so now this is working. Thanks – Ali Baba Jan 06 '20 at 13:12