"Method not found: 'System.Net.Http.HttpRequestMessage System.Web.Http.ApiController.get_Request()'."
I found a solution to this.
After I started building, there was build warnings going to the output window but not showing in the main error / warning window.
Check your output/error window if there are errors or warning then try to solve it.
They were to do with assembly conflicts and said recommend putting the assembly redirect in the web.Config.
Once I had went through them all, it now works.
For example:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
other thing you can try is: make your method like
public IHttpActionResult CreateCustomer([FromBody]CustomerDTO customerDTO){}
see if this helps.
I have the same problem but from a different side. I have the MyProject with System.Net.Http library and MyUnitTestProject with System.Net.Http too. Once upon a time then I started Unit Tests it crashed with a strange problem. Inconclusive: test not run:
And where was some exception "JetBrains exited with code ...." which says nothing for me:
Then I figured out what the problem was in the binding redirect for System.Net.Http which was added by some NuGet package. I remove the binding redirect, but gain another exception, close to yours "System.Net.Http.HttpRequestMessage...”:
The problem was in versions of libraries - in MyProject was 4.0.0.0 (from .net Framework), but MyUnitTestProject was 4.2.0.0 (from Visual Studio folder), and the binding redirect was added for 4.2.0.0 which I think somehow cant be found. So I change it to 4.0.0.0 and it worked:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
</dependentAssembly>