Server Error: Entry point was not found.

Sep 10, 2014 at 3:20 PM
Edited Sep 10, 2014 at 3:25 PM
Hi,
I have the same error as here.

I've included the stack trace below. Does anyone have any hints on possible solutions? I previously used Autofac and just checking Simple Injector out.
Entry point was not found.

[EntryPointNotFoundException: Entry point was not found.]
   System.Web.Mvc.DependencyResolverExtensions.GetService(IDependencyResolver resolver) +56
   System.Web.Mvc.SingleServiceResolver`1.GetValueFromResolver() +43
   System.Lazy`1.CreateValue() +415
   System.Lazy`1.LazyInitValue() +152
   System.Lazy`1.get_Value() +75
   System.Web.Mvc.SingleServiceResolver`1.get_Current() +15
   System.Web.Mvc.MvcRouteHandler.GetSessionStateBehavior(RequestContext requestContext) +126
   System.Web.Mvc.MvcRouteHandler.GetHttpHandler(RequestContext requestContext) +33
   System.Web.Mvc.MvcRouteHandler.System.Web.Routing.IRouteHandler.GetHttpHandler(RequestContext requestContext) +10
   System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +9599408
   System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +82
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
I installed from nuget.

My setup is very simple. One interface and one class:
 private static void InitializeContainer(Container container)
 {
     // For instance:
     // container.Register<IUserRepository, SqlUserRepository>();

     container.Register<IWidgetRepository, WidgetRepository>();
}
I'm using .NET 4.5 and MVC framework 4.

Thanks,
Coordinator
Sep 10, 2014 at 4:41 PM
This might be caused by invalid assembly bindings or because you're using an old version of Razor or something similar. Take a look at the following Stackoverflow questions:
Sep 10, 2014 at 5:43 PM
Thanks for the reply.

I looked in the web.config file but couldn't find any assembly bindings for Razor or Simple Injector.

I also tried the latest version of Simple Injector: "2.6.0-beta1" but got the same error.
Coordinator
Sep 10, 2014 at 5:49 PM
Edited Oct 21, 2014 at 5:46 PM
Most of the time NuGet will manage the assembly bindings for you, but sometimes it fails so you need to make sure that the bindings are correct. The Simple Injector MVC integration package depends upon MVC 3.0, and if you installed a newer version, you need to have a binding direct to point at a never version of MVC. That could be causing the issue. Here's an example of such binding redirect. This especially happens in case you use the default VS template for MVC. The MVC integration guide warns about this.
Sep 10, 2014 at 8:08 PM
Edited Sep 10, 2014 at 8:10 PM
I'd always wondered what those config sections were for.

I made those changes, adding the following section to web.config.
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
My solution compiled but threw an error trying to create the controller. It's a Web Api controller so that might be the reason...

Anyway, I came across this blog which outlined a method I was able to get working. Which is good enough for now.

It seems I wasn't the only one lured to Simple Injector for performance reasons.

Thanks again for the swift responses.
Dec 16, 2014 at 7:22 PM
I second codesz. Using nuget packages for MVC and WebApi doesn't work. Visual Studio 2015, MVC 5.2.2.0.
Manually creating resolvers works perfectly.