Question

I need to create a performance monitoring interceptor that will be hooked up via Autofac. Unfortunately, it's for an MVC3 project, meaning that I'm using Autofac 2.6.3, because Autofac 3 is only compatible with MVC4. As such, I cannot use the Autofac.Extras.DynamicProxy2 Nuget package, because it isn't compatible with MVC3.

I've found AutofacContrib.DynamicProxy2, which is compatible with Autofac 2.6.3. The problem is, the Nuget package doesn't install due to a version mismatch between the dependencies. The problem is highlighted below:

  • AutofacContrib.DynamicProxy2
    • Depends on 'Autofac (>= 2.4.5.724)'
    • Depends on 'Castle.Core (>= 2.5.2)'.
    • Depends on 'Castle.DynamicProxy (>= 2.2.0)'.
      • Depends on 'Castle.Core (= 1.2.0)'.

I get the following Nuget package install error:

Updating 'Castle.Core 2.5.2' to 'Castle.Core 1.2.0' failed. Unable to find a version of 'AutofacContrib.DynamicProxy2' that is compatible with 'Castle.Core 1.2.0'

How can I perform method interception with MVC3 and Autofac?

Était-ce utile?

La solution

Looks like I can install 'DynamicProxy2', thanks to this article

Basically, after installing AutofacContrib.DynamicProxy2 and getting the error, I need to install it again with the -ignoredependencies flag and it installs OK.

Run this command:

install-package autofaccontrib.dynamicproxy2

Followed by this command:

install-package autofaccontrib.dynamicproxy2 -ignoredependencies

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top