0

Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'testapp, Culture=neutral, PublicKeyToken=null' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500

File name: 'testapp, Culture=neutral, PublicKeyToken=null' ---> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException: /Users/brilliomac/Desktop/testapp/Controllers/HomeController.cs(26,48): DNXCore,Version=v5.0 error CS1061: 'HttpContent' does not contain a definition for 'ReadAsAsync' and no extension method 'ReadAsAsync' accepting a first argument of type 'HttpContent' could be found (are you missing a using directive or an assembly reference?)

I got solution from this link I tried to add assembly to web.config still I am getting same error

My web.config file

<?xml version="1.0" encoding="utf-8"?>
 <configuration>
  <system.webServer>
   <handlers>
     <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
   </handlers>
   <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/>
  </system.webServer>
  <system.web> 
   <compilation debug="true" targetFramework="4.0">
     <assemblies>
         <add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
     </assemblies>
   </compilation>
  </system.web> 
</configuration>

tried this also

<system.webServer>
   <handlers>
     <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
   </handlers>
   <assemblies>
         <add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </assemblies>
   <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/>
</system.webServer>
Community
  • 1
  • 1
Praveenkumar
  • 921
  • 1
  • 9
  • 28

1 Answers1

0

Can you confirm you are using Mac?

I would use the command dnu install Microsoft.AspNet.WebApi.Client and then attempt to recompile. This should hopefully resolve your issue.

This should be the package you require.

Mike
  • 46
  • 3