Namespace System.Web.Http.Results not found within asp.net web api application
Asked Answered
C

4

6

I have an asp.net web api application in which I have this line :

using System.Web.Http.Results;

My problem is that the namespace isn't recognized, I verified the dll system.Web.Http exists in the bin folder !!

So I need to know:

  • What is the reason of this problem?
  • How can I fix it?
Collen answered 5/12, 2016 at 14:50 Comment(0)
S
10

You need reinstalling the NuGet package, which corrects broken dependencies. Open package manager and run Update-Package Microsoft.AspNet.WebApi -reinstall.

Strauss answered 5/12, 2016 at 14:55 Comment(1)
some version details should be included for this answer.Yingyingkow
O
0

The above solution didn't work for me as it was failing on some other package too. My solution was to delete the packages folder and rebuild the project, which retrieved all the packages again.

Ozalid answered 24/5, 2018 at 11:38 Comment(0)
P
0

I think I got around this problem by installing the following package using NuGet:

Install-Package Microsoft.AspNet.WebApi.Core

I followed these two answers from here: https://mcmap.net/q/1628489/-failure-to-include-system-web-http-in-unit-tests and https://forums.asp.net/t/2096814.aspx?

Pepsinogen answered 11/8, 2020 at 13:33 Comment(0)
T
0

Your class needs to inherit from ApiController in order for the methods to be available. I ran into this trying to abstract too much logic away from my controller.

Tergiversate answered 29/11, 2023 at 18:1 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.