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.

Leave a Comment