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 8224487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:05:27+00:00 2026-06-07T15:05:27+00:00

It seems that when I installed the Simple Injector MVC3 Integration package, SimpleInjectorInitializer was

  • 0

It seems that when I installed the Simple Injector MVC3 Integration package, SimpleInjectorInitializer was placed in the App_Start folder. However, when the Verify() method is called within Initialize(), it produces this error when attempting to get the Entity Framework Object Context (I have also provided the inner exceptions):

The supplied connection string is not valid, because it contains insufficient mapping or metadata information.
    InnerException: Unable to determine application context. The ASP.NET application path could not be resolved.
        InnerException: Exception has been thrown by the target of an invocation.
            InnerException: (Shown in browser) This method cannot be called during the application's pre-start initialization phase.

It also seemed that I had to move the registration calls from the Global.asax.cs Application_Start() to the SimpleInjectorInitializer’s InitializeContainer() method.

I am not entirely sure what to do at this point, but this issue seems somewhat related to this question: Connection string exception after upgrading to Ninject 3.0.0-rc3

It seems that the application is trying to load the context before Entity Framework is even aware of its own and is unable to properly parse the connection string?

  • 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-07T15:05:29+00:00Added an answer on June 7, 2026 at 3:05 pm

    It seems that the application is trying to load the context before
    Entity Framework is even aware of its own and is unable to properly
    parse the connection string?

    You are absolutely right. The SimpleInjectorInitializer.Initialize method is called automatically during the pre application start phase. Although there is no problem configuring the container at this point, in your situation it’s too early for Verify() to be called. Verify simply iterates all registrations and calls GetInstance on them to see whether it can create it. At that point in the application’s lifetime however, an Entity Framework object context can’t be created. I must say I think it is weird that EF framework knows anything about the ASP.NET framework, but unfortunately that’s the way it is.

    To solve this problem, you can either move the Verify() call, or the complete initialization to a later moment in the application startup. For instance, you can do the following:

    1. Remove the [assembly: WebActivator.PreApplicationStartMethod] (top line) of the SimpleInjectorInitializer.cs class.
    2. Add a call to the SimpleInjectorInitializer.Initialize() method in the Application_Start() event of the global asax.

    After doing this, initializing (and especially, verifying) of the object graph is done after the pre-init state.

    Another option is to remove the container.Verify(); call from the SimpleInjectorInitializer.Initialize method, since it is the early verification process that is killing you. However, please read this Verify the container’s configuration first, to see alternatives, before doing so.

    The SimpleInjector.MVC NuGet package uses the WebActivator.PreApplicationStartMethod for convenience. It allows the package to ‘just work’, without a need for a developer to do any manual coding (except of course wiring the container) to get this working. But since this doesn’t work when working with Entity Framework, we will have to reconsider this strategy.

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

Sidebar

Related Questions

I tried to install Ruby 1.9.3 using RVM. It seems that it installed without
I have a py27-tkinter macport installed and it seems that it is compiled without
I'm trying to write a simple java applet program, but it seems that I'm
I have weird situation in newly installed server, and it seems that Google can't
Seems that This will be an easy question for you but this problem is
Seems that even after unchecking the option in the PyDev/Debug preferenecs pane to launch
It seems that we can show layers and even use a different zPosition for
It seems that runClasses() doesn't terminate the code being tested even after the test
It seems that JavaScript's Date() function can only return local date and time. Is
It seems that often I find that my code when moving either from one

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.