Current project is an Mvc4 application, I had Ioc working and recently it just stopped.
DependencyResolver.SetResolver(New UnityDependencyResolver(RegisterIocServices()))
That line was working, and now I am getting the following error:
ArgumentException was unhandled by user code
The type Unity.Mvc3.UnityDependencyResolver does not appear to
implement Microsoft.Practices.ServiceLocation.IServiceLocator.
Parameter name: commonServiceLocator
Anybody experiencing this? Any thoughts or advice?
Thanks in advance.
Uninstalling/reinstalling the Unity MVC package did not resolve the issue. I ended up having to put a hard reference in the project to the Microsoft.EnterpriseLibrary.Common library and that seemed to clear it up for a week or two.
I then started seeing the error reappear intermittently, doing a full solution clean and build resolved it once in awhile. It would work, then all of a sudden revert to the error message.
So I finally gave up on Unity.Mvc this morning and implemented Autofac instead. Once I set up my bootstrapper file for Autofac, it worked on the first compile and has been stable all morning.
Here is the boostrapper file for Autofac in case anyone needs a sample. NOTE: I use WebActivator to get all of my bootsrapping classes to run pre-startup instead of putting a bunch of code in the Global.asax.vb file.