Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:54:55+00:00 2026-06-04T14:54:55+00:00

Current project is an Mvc4 application, I had Ioc working and recently it just

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:54:57+00:00Added an answer on June 4, 2026 at 2:54 pm

    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.

    #Region "Imports"
    
    Imports System.Reflection
    Imports Autofac
    Imports Autofac.Integration.Mvc
    Imports MyCompany.Data.Repositories
    Imports MyCompany.Services
    Imports MyCompany.Web.Mvc.Public.Bootstrap
    Imports MyCompany.Web.Mvc.Public.Services
    
    #End Region
    
    #Region "Assembly Meta"
    
    ' This tells the app to run the "Start" method prior to running the App_Start method in Global.asax
    <Assembly: WebActivator.PreApplicationStartMethod(GetType(AutofacDI), "Initialize")> 
    
    #End Region
    
    Namespace MyCompany.Web.Mvc.Public.Bootstrap
    
        ''' <summary>
        ''' Class to setup dependency injection and register types/services.
        ''' </summary>
        ''' <remarks></remarks>
        Public NotInheritable Class AutofacDI
    
            ''' <summary>
            ''' Method to register the Unity dependency injection component.
            ''' </summary>
            ''' <remarks>
            ''' This line of code below could alternatively be placed in Global.asax App_Start(), doing
            ''' so in this manner ensures that this gets run "PreStart".
            ''' </remarks>
            Public Shared Sub Initialize()
    
                ' Create Unity dependency container.
                Dim dependencyContainer = BuildIocContainer()
    
                ' Set DI resolver
                DependencyResolver.SetResolver(New AutofacDependencyResolver(dependencyContainer))
    
            End Sub
    
            ''' <summary>
            ''' Registers the IOC types/services.
            ''' </summary>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Private Shared Function BuildIocContainer() As Autofac.IContainer
    
                Dim builder = New ContainerBuilder
    
                With builder
                    ' Register Controllers
                    .RegisterControllers(Assembly.GetExecutingAssembly())
    
                    ' Custom MyCompany/Mvc objects
                    .RegisterType(Of FormsAuthenticationService)().As(Of IFormsAuthenticationService)().InstancePerHttpRequest()
                    .RegisterType(Of AccountMembershipService)().As(Of IMembershipService)().InstancePerHttpRequest()
    
                    '***************************************************************
                    '*  MyCompany service objects.
                    '***************************************************************
                    ' This is auto registration, it replaces all the individual registration lines of code below.
                    builder.RegisterAssemblyTypes(GetType(CatalogCodeService).Assembly).
                        Where(Function(t) t.Name.EndsWith("Service")).AsImplementedInterfaces().InstancePerHttpRequest()
    
                    '***************************************************************
                    '*  MyCompany repository objects (used by service objects above)
                    '***************************************************************
                    ' This is auto registration, it replaces all the individual registration lines of code below.
                    builder.RegisterAssemblyTypes(GetType(CatalogCodeRepository).Assembly).
                        Where(Function(t) t.Name.EndsWith("Repository")).AsImplementedInterfaces().InstancePerHttpRequest()
                End With
    
                Return builder.Build()
    
            End Function
    
        End Class
    
    End Namespace
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Current project recently had a mess of changes to the DB schema. These were
Current Project Setup I've been working on a web-based chat, similar to Facebook chat.
Our current project is made up of Python2.3 and wxPython-2.4.1.2. It is working fine.
In my current project we're trying to write an application (using SUN RI JSF
My current project is about doing some changes in an already build web application
The current project I'm working on, I am trying to explore a bunch of
The current project I'm working requires me to follow certain procedures to eliminate whitespace
The current project i am working on is extensively using web services and is
Our current project at work is a new MVC web site that will use
The current project in wherein I'm working creates a log file using the log4j

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.