4

I am using Windows Azure Web Jobs to execute my method to get the tweets using LinqToTwitter. My web.config file has

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.22.0" newVersion="4.2.22.0" />
</dependentAssembly>

When I debug my test project I don't get any error. But after publishing my web api to Azure, I am getting below error when the web job runs:

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

See more log info here.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
sravan
  • 93
  • 1
  • 8
  • [link](http://stackoverflow.com/questions/18370360/could-not-load-file-or-assembly-system-net-http-primitives-located-assemblys-m) hope this can help – Sachu May 28 '15 at 14:48
  • Hi @Sachu, I have updated the Microsoft Http Client Libraries and LinqToTwitter to latest versions. Now I get different error. Error : LinqToTwitter.TwitterQueryException: Missing or invalid url parameter.http://justpaste.it/lezv – sravan May 28 '15 at 18:29
  • Hey everything working fine now. The solution was to update both dll's and as per [Joe mayo's solution](http://stackoverflow.com/questions/16889209/search-fails-with-maxid-ulong-max-and-sinceid-set-but-separately-it-works/30535570#30535570), I am able to fix Missing or invalid url parameter error too. – sravan May 29 '15 at 17:27

1 Answers1

1

I solved my similar problem by having to install Microsoft HTTP Client Libraries 4.2.29.0 in the main WPF application even though I have no use for them in there. My TESTER app against my YouTubeDataV3.DLL assembly works but not when I try to consume it from WPF app (all projects were set to NET 4.5).

I did initially try to modify manually app.config and C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config as well, but I always kept seeing the same exceptions

System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.Primitives, Version=4.2.29.0...

System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

I think there is something wrong with NuGet in that it stores the package folder peer to the solution, instead of peer to the project's references managed by NuGet. IOW, If you have x number of clients projects applications consuming an Assembly "A" whose references are managed by NuGet, then you end up with x number of package folders scattered all over the place wherever the solution (.SLN) files are. That's really ugly plus keep in mind, all of that junk :), will get copied to bin/debug and bin/release :( one more time. What a wasteful approach.

Community
  • 1
  • 1
Meryan
  • 1,285
  • 12
  • 25