Type argument ‘System.Net.Http.Headers.MediaTypeHeaderValue’ violates the constraint of type parameter ‘T’

It was not immediately clear to me what to do when I read the correct answer above – For those running into the same issue : just change/add the mapping in your app.config / web.config in the configuration/runtime/assemblyBinding section:

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

UPDATE

.Net core team updated System.Net.Http package to 4.3.1 on 21/2/2017.
So if you can update you shouldn’t need this redirect anymore.

Details of the issue: https://github.com/dotnet/corefx/issues/11100

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)