MVC, Programming

Owin.IAppBuilder does not contain definition for UseWebApi

At some point of time you might had encountered issues with Owin.IAppBuilder giving error in Startup class which states

‘Owin.IAppBuilder’ does not contain a definition for ‘UseWebApi’ and no extension method ‘UseWebApi’ accepting a first argument of type ‘Owin.IAppBuilder’ could be found (are you missing a using directive or an assembly reference?)

This basically happens when try to add route configuration to the OWIN pipeline while using ASP.NET Web API2 OWIN. You might try updating the OWIN package from 3.0.0.0 to 3.0.1.0 using the NuGet command update-package Microsoft.Owin but that will not resolve the issue.

Solution is you need to install Microsoft ASP.NET Web API2 OWIN Self Host which will resolve the issue. You can use the NuGet command Install-Package Microsoft.AspNet.WebApi.OwinSelfHost

image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s