Lamloumi Afif
Lamloumi Afif

Reputation: 9081

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

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:

Upvotes: 6

Views: 9671

Answers (4)

DwankyDan
DwankyDan

Reputation: 49

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.

Upvotes: 0

jyrkim
jyrkim

Reputation: 2869

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://stackoverflow.com/a/49448133/2048391 and https://forums.asp.net/t/2096814.aspx?

Upvotes: 0

ViqMontana
ViqMontana

Reputation: 5688

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.

Upvotes: 0

Mihai Alexandru-Ionut
Mihai Alexandru-Ionut

Reputation: 48367

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

Upvotes: 10

Related Questions