There is a project originally pure ASP.NET MVC, I want to implement Web API functionality in it. Added the following files to the project:

  • App_Start \ WebApiConfig.cs

  • Providers \ ApplicationOAuthProvider.cs

  • Controllers \ ValuesController.cs

When starting the project, 3 errors occur:

CS1061 'HttpConfiguration' doesn’t contain a definition for 'SuppressDefaultHostAuthentication' and no extension method 'App_Start \ WebApiConfig.cs


CS0246 The host or the namespace name of the hostAuthenticationFilter could not be found. App_Start \ WebApiConfig.cs


CSH1061 'HttpConfiguration' does not contain a definition for 'MapHttpAttributeRoutes' and no extension method' AppHStart \ WebApiConfig.cs

App_Start \ WebApiConfig.cs content:

public static void Register(HttpConfiguration config) { config.SuppressDefaultHostAuthentication(); config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType)); config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } 

Googling led me to nothing good (

1 answer 1

Files alone are not enough, you need to install the required version of Web API via NuGet as well.

  • Can you give more details? I transferred all missing packages to packages.config from the standard project from the Web API. - alfixed
  • It is necessary not to transfer, but to install via NuGet. When installing, the settings in XXX.config files are written in and the corresponding dlls are downloaded and installed. ( telerik.com/support/kb/data-access/details/… ) - Karen Tazayan