Autofac.WebApi2 6.1.1

The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved
.NET Framework 4.7.2
dotnet add package Autofac.WebApi2 --version 6.1.1
NuGet\Install-Package Autofac.WebApi2 -Version 6.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Autofac.WebApi2" Version="6.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Autofac.WebApi2 --version 6.1.1
#r "nuget: Autofac.WebApi2, 6.1.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Autofac.WebApi2 as a Cake Addin
#addin nuget:?package=Autofac.WebApi2&version=6.1.1

// Install Autofac.WebApi2 as a Cake Tool
#tool nuget:?package=Autofac.WebApi2&version=6.1.1


ASP.NET Web API integration for Autofac.

Build status

Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.

Quick Start

To get Autofac integrated with Web API you need to reference the Web API integration NuGet package, register your controllers, and set the dependency resolver. You can optionally enable other features as well.

protected void Application_Start()
  var builder = new ContainerBuilder();

  // Get your HttpConfiguration.
  var config = GlobalConfiguration.Configuration;

  // Register your Web API controllers.

  // OPTIONAL: Register the Autofac filter provider.

  // OPTIONAL: Register the Autofac model binder provider.

  // Set the dependency resolver to be Autofac.
  var container = builder.Build();
  config.DependencyResolver = new AutofacWebApiDependencyResolver(container);

Check out the documentation for more usage details.

Get Help

Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.

Product Versions
.NET Framework net472 net48 net481
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (81)

Showing the top 5 NuGet packages that depend on Autofac.WebApi2:

Package Downloads
Autofac.WebApi2.Owin The ID prefix of this package has been reserved for one of the owners of this package by

ASP.NET Web API OWIN integration for Autofac.




Framework for BumperLane API sites


Productivity enhancements to Autofac WebApi Integration


Data transfer objects for TouchConvert version one APIs.

GitHub repositories (28)

Showing the top 5 popular GitHub repositories that depend on Autofac.WebApi2:

Repository Stars
Open Source ASP.NET MVC Enterprise eCommerce Shopping Cart Solution
OpenID Connect Provider and OAuth 2.0 Authorization Server Framework for ASP.NET 4.x/Katana
NuGet Gallery is a package repository that powers Use this repo for reporting issues.
ASP.NET Web API CacheOutput - library to allow you to cache the output of ApiControllers
Fluent testing framework for ASP.NET Web API 2.
Version Downloads Last updated
6.1.1 120,475 8/2/2022
6.1.0 378,826 11/18/2021
6.0.1 986,749 12/1/2020
6.0.0 567,315 9/30/2020
5.0.0 2,256,614 1/30/2020
4.3.1 1,844,865 9/5/2019
4.3.0 180,801 8/15/2019
4.2.1 1,482,294 3/26/2019
4.2.0 2,626,921 6/21/2018
4.1.0 3,316,697 8/2/2017
4.0.1 3,118,590 10/24/2016
4.0.0 2,128,576 8/17/2016
4.0.0-rc3-225 3,312 8/3/2016
4.0.0-beta7-215 33,889 9/23/2015
3.4.0 3,789,391 8/17/2014
3.3.3 173,407 7/2/2014
3.3.0 58,023 5/9/2014
3.2.1 23,831 3/27/2014
3.2.0 54,027 1/28/2014
3.1.0 43,030 12/28/2013
3.0.0 37,232 10/24/2013