.

Solved – The type or namespace IHttpActionResult not found (Web API 2 error)

Trying to use Web API 2 but getting the following error:
error CS0246: The type or namespace name ‘IHttpActionResult’ could not be found (are you missing a using directive or an assembly reference?)

Solution:

Tools – > Library Package Manager -> Package Manager Console, then type:

Install-Package Microsoft.AspNet.WebApi -Version 5.0.0

sometimes you must try:

update-Package Microsoft.AspNet.WebApi –reinstall

 

11 Responses to this post.

  1. Posted by koushik on 11.09.14 at 6:06 pm

    I Have tried both stepos but i am not able to get it

  2. Posted by pietman on 11.09.14 at 6:06 pm

    What exactly is the error you’re getting and what is the context of your problem?

  3. Posted by Joe V on 11.09.14 at 6:06 pm

    The reinstall worked for me. Thank you!

  4. Posted by Baseer on 11.09.14 at 6:06 pm

    Thanks alot man, it works for me.

  5. Posted by Joy Acharya on 11.09.14 at 6:06 pm

    Thanks for the solution.

  6. Posted by Hosting on 11.09.14 at 6:06 pm

    In order to be able to reuse this in different controllers we need and new class named  ApiControllerExtension  which contains a method returns this customized Not Found response type.

  7. Posted by Mohd Irshad on 11.09.14 at 6:06 pm

    Thanks a lot, it worked after Install.

  8. Posted by Gourav on 11.09.14 at 6:06 pm

    the update command worked for me , thanks man

  9. Posted by Gourav on 11.09.14 at 6:06 pm

    Update command worked for me (update-Package Microsoft.AspNet.WebApi), thanks man

  10. Posted by venkatesh on 11.09.14 at 6:06 pm

    Its absolutely working man,thanks alot…

  11. Posted by Raj Bhardwaj on 11.09.14 at 6:06 pm

    Thanks Sir Ji, it works for me also.

What's your thoughts on this?

*

Protected by WP Anti Spam