riccardo
riccardo

Reputation: 81

IApplicationBuilder does not contain a definition for UseWebApi

The VS 2015 Update 3 is out and I have started playing with it. But I hit a problem soon after. The IApplicationBuilder interface does not appear to have a definition for the UseWebApi extension method, but IAppBuilder does. In effect, I want to register my Web Api with the OWIN pipeline. Am I missing something?

Upvotes: 7

Views: 12600

Answers (4)

Lance Kind
Lance Kind

Reputation: 1091

For me, I had some references that were causing this to happen. I removed microsoft.owin.cors and added only the following three owin related dependencies:

  • Microsoft.Owin
  • Microsoft.Owin.Hosting
  • Microsoft.AspNet.WebApi.OwinSelfHost,

then did a "clean" and a "rebuild", the correct IAppBuilder linked and the build error went away.

Upvotes: 0

Josh
Josh

Reputation: 2222

NuGet command:

Install-Package Microsoft.AspNet.WebApi.OwinSelfHost

Source

Upvotes: 9

riccardo
riccardo

Reputation: 81

There is no need for the IApplicationBuilder interface to have a definition for the UseWebApi extension method. In IAppBuilder, it was used to register a Web Api with OWIN. But for IApplicationBuilder, because ASP.NET Core uses a unified model for both Web Api and MVC services, simply use the IApplicationBuilder.UseMvc method. It works!

Upvotes: 1

Pawel
Pawel

Reputation: 31610

There is no UseWebApi in Asp.NET Core so I am not sure what the "relevant package" is. Here is a tutorial showing how to build Web API with Asp.NET Core.

Upvotes: 0

Related Questions