Autofac.Mvc5.Owin 6.1.0

Prefix Reserved
dotnet add package Autofac.Mvc5.Owin --version 6.1.0                
NuGet\Install-Package Autofac.Mvc5.Owin -Version 6.1.0                
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.Mvc5.Owin" Version="6.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Autofac.Mvc5.Owin --version 6.1.0                
#r "nuget: Autofac.Mvc5.Owin, 6.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Autofac.Mvc5.Owin as a Cake Addin
#addin nuget:?package=Autofac.Mvc5.Owin&version=6.1.0

// Install Autofac.Mvc5.Owin as a Cake Tool
#tool nuget:?package=Autofac.Mvc5.Owin&version=6.1.0                


OWIN support for the ASP.NET MVC integration for Autofac.

Build status

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

If you're working with ASP.NET Core, you want Autofac.Extensions.DependencyInjection, not this package.

Quick Start

If you are using MVC as part of an OWIN application, you need to:

public class Startup
  public void Configuration(IAppBuilder app)
    var builder = new ContainerBuilder();


    // Register your MVC controllers.

    // Run other optional steps, like registering model binders,
    // web abstractions, etc., then set the dependency resolver
    // to be Autofac.
    var container = builder.Build();
    DependencyResolver.SetResolver(new AutofacDependencyResolver(container));


    // Register the Autofac middleware FIRST, then the Autofac MVC middleware.

Minor gotcha: MVC doesn't run 100% in the OWIN pipeline. It still needs HttpContext.Current and some other non-OWIN things. At application startup, when MVC registers routes, it instantiates an IControllerFactory that ends up creating two request lifetime scopes. It only happens during app startup at route registration time, not once requests start getting handled, but it's something to be aware of. This is an artifact of the two pipelines being mangled together.

Check out the Autofac ASP.NET MVC integration documentation for more information.

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 Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Autofac.Mvc5.Owin:

Package Downloads

Useful extensions/tools/utils I keep using all over the place. Hit me up (@bscheiman) if you need help.


support OWIN

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Autofac.Mvc5.Owin:

Repository Stars
NuGet Gallery is a package repository that powers Use this repo for reporting issues.
Version Downloads Last updated
6.1.0 138,852 8/23/2022
6.0.0 518,290 10/5/2020
5.0.0 307,653 1/31/2020
4.0.1 1,372,580 2/8/2017
4.0.0 197,939 8/10/2016
4.0.0-rc3-217 2,115 7/25/2016
3.1.0 328,168 8/21/2014
3.0.1 4,279 6/20/2014
3.0.0 2,027 6/20/2014
3.0.0-alpha3 1,285 3/27/2014
3.0.0-alpha2 1,160 3/26/2014
3.0.0-alpha 1,117 2/17/2014