简体   繁体   中英

Flurl Missing Method Exception?

I am using Flurl to consume an API and for the most part it's working great. However I have some users getting a missing method exception. I'm trying to get a full stack trace from one of the users experiencing it but so far I just have a screen shot of the message. The exception message is:

System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage>Flurl.Http.GeneratedExtensions.PostJsonAsync(Flurl.Http.IFlurlRequest, System.Object, System.Threading.CancellationToken, System.Net.Http.HttpCompletionOption)

Here is the strange thing; I was originally not including System.Net.Http in my installation and everything seemed to work fine for most users, but some started getting an 'unable to load System.Net.Http version 4.1.x' (don't remember the x part but it was 4.1.something...). Anyway I looked and it is building with System.Net.Http 4.6.26907.1 when I reference Flurl.Http 2.4.2.0. When I include that with the install they get the above error. This is only for a few users, most (including my dev machine) don't get any errors and work fine which I don't understand.

Anyone know why it would be doing this and especially why it would be on some machines and not others?

That's a pretty common problem with System.Net.Http . I've run into it before and the more of a "clean slate" I get down to, the better luck I have had. Try this:

  1. Uninstall both Flurl and Flurl.Http NuGet packages.
  2. Are you on .NET Framework? If so, and you have System.Net.Http installed via NuGet, uninstall that too. You probably don't need it.
  3. Check your web.config or app.config file and remove any binding redirects associated with System.Net.Http . (Don't quote me on this, but I think I've even solved this by removing all mentions of System.Net.Http from *.config entirely. If you try that, just be sure you can roll it back.)
  4. Reinstall Flurl.Http. (It'll pull the core Flurl with it so don't do them separately.)

Of course if this doesn't work you can always sift through the huge number of similar questions linked above. It's frustrating, and I don't think any single answer has worked in all situations. Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM