I have a Error after update Autofac.Mvc5 from 3.3.2 to 3.3.3 I posted my issue to github https://github.com/autofac/Autofac/issues/572#issuecomment-63236738 and got response that I need to ask here :)
Below my situation:
What I have:
// Setup DI as default MVC controller factory
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
I need this to use in injected property of Custom Membership Provider
protected IMembershipService MembershipService
{
get
{
return DependencyResolver.Current.GetService();
}
}
issue: The dependency resolver is not of type 'Autofac.Integration.Mvc.AutofacDependencyResolver'
Please help me to solve this.
UPDATE So now I have such error after update from 3.3.2 to
The dependency resolver is not of type 'Autofac.Integration.Mvc.AutofacDependencyResolver' and does not appear to be wrapped using DynamicProxy from the Castle Project. This issue could be the result of a change in the DynamicProxy implementation or the use of a different proxy library to wrap the dependency resolver.
Any Ideas on how to solve that?
url to image error http://i.stack.imgur.com/yJJXX.png
UPDATE Here what i found github.com/autofac/Autofac/blob/82cc138596e74095f50720319feb2a2ce734310d/Core/Source/Autofac.Integration.Mvc/AutofacDependencyResolver.cs on this file we have part where exception throws for such text. This is only one part in all source code, so I think I need to move forward and find out why I'm getting this issue. Also when and why my code request this method AutofacDependencyResolver.Current. As I checked that I have NO direct calls of AutofacDependencyResolver.Current. I need to investigate other variants (places) of calls.
i was not working for me this line:
so i changed it by this:
and it works now.
Thanks for the solution!
I had the same issue.
It is due to MvcSiteMapProvider using it's own DI.
You can resolve the issue by making use of the NuGet package MvcSiteMapProvider MVC5 Autofac Dependency Injection Configuration and setting up Autofac as described in the readme for this project.
For now I see such resolution
As you can see I commented this row
BUT I need confirmation if that is ok!
Please, who knows explain if it is correct and/or how to be.
TRACE RESULT BELOW - NEED HELP
After my new investigation I found out the issue. My website uses MVCSiteMap
http://i.stack.imgur.com/7xnul.png
I am checking now on how to configure MvcSiteMapProvider to not change DI.
So I think that I need to change it to true to solve issue. I am in progress on it now and let you know soon.
Feel free to update my view if you have solution!