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

  • Home
  • SEARCH
  • 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 8125695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:54:03+00:00 2026-06-06T06:54:03+00:00

I have a layered web application that I built with ASP.NET MVC 4, WebAPI

  • 0

I have a layered web application that I built with ASP.NET MVC 4, WebAPI and some other components. I’m using the latest release of Autofac 2.6.2.859 as my DI container along with the MVC and WebAPI integrations. I have autofac modules setup in my different layers and I’m using the new RegisterAssemblyModules to scan the AppDomain assemblies for the various modules.

On startup every works great. When I edit the web.config file and the application warms up, my registrations are lost. I get a DependencyResolutionException –

None of the constructors found with ‘Public binding flags’ on type ‘My.Class.Name’ can be invoked with the available services and parameters:

So my registrations are not being reloaded. Does anyone know how to address this issue? Should I put my initialization code somewhere else other than Application_Start() ?

UPDATE

Here’s what my code looks like

 public static class IoC
{
    public static void Configure()
    {
        var builder = new ContainerBuilder();
        var assemblies = AppDomain.CurrentDomain.GetAssemblies();

        //Assembly Modules            
        builder.RegisterAssemblyModules<NSUTriviaModuleBase>(assemblies);

        // Register API controllers using assembly scanning.
        builder.RegisterControllers(assemblies);

        // Register API controllers using assembly scanning.
        builder.RegisterApiControllers(assemblies);

        var container = builder.Build();
        // Set the dependency resolver implementation.
        var resolver = new AutofacWebApiDependencyResolver(container);

        GlobalConfiguration.Configuration.DependencyResolver = resolver;
        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
    }
}
  • 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-06T06:54:05+00:00Added an answer on June 6, 2026 at 6:54 am

    I think the problem is that all assemblies are loaded into the AppDomain when the application first starts, but when the AppDomain is recycled by IIS the assemblies are then only loaded on demand.

    Try using the GetReferencedAssemblies method on System.Web.Compilation.BuildManager to get a list of the referenced assemblies instead.

    var assemblies = BuildManager.GetReferencedAssemblies().Cast<Assembly>();
    

    That should force the referenced assemblies to be loaded into the AppDomain immediately making them available for module scanning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a multi-layered application that has an ASP.NET MVC web application. It
I am developing a multi-layered, using ASP.NET MVC 3 and Entity Framework. I have
I have a 4 layered web application programmed in C#... .Net 4.0: UI Layer
I have a 'Layered' Application: PresentationMVC ServiceLayer BusinessLogicLayer (BLL) DataLayer I'm using Entities from
I've written a layered web application that consists of a rich-web client (PHP) that
I have been given to develop a web application that can have multiple presentation
We are looking at implementing transactions in our ASP.NET web application. Its a three
I have a layered application with namespaces: App.Core - business layer logic services App.Data
I have a layered worker class that I'm trying to get progress reports from.
I have a layered application. I am trying to determine where to place a

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.