30

I have installed vs2012 (11.0.50727.1),
I opened a new MVC4 with .NET 4.5 solution,
i create a simple HomeController and as I've wanted to start it locally, i have received this very strange error:
How can resolve it? What is this error and why it's happens???

Thank you in advance, for any of your help.

    Server Error in '/' Application.
Entry point was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.EntryPointNotFoundException: Entry point was not found.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[EntryPointNotFoundException: Entry point was not found.]
   System.Web.Mvc.IDependencyResolver.GetService(Type serviceType) +0
   System.Web.Mvc.DependencyResolverExtensions.GetService(IDependencyResolver resolver) +56
   System.Web.Mvc.SingleServiceResolver`1.GetValueFromResolver() +44
   System.Lazy`1.CreateValue() +180
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22
   System.Lazy`1.get_Value() +10749357
   System.Web.Mvc.SingleServiceResolver`1.get_Current() +15
   System.Web.Mvc.MvcRouteHandler.GetSessionStateBehavior(RequestContext requestContext) +121
   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) +9709656
   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


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929 
leppie
  • 115,091
  • 17
  • 196
  • 297
hackp0int
  • 4,052
  • 8
  • 59
  • 95

12 Answers12

24

I have converted a project from MVC3+.NET4 to MVC4+.NET4.5 and I receive the exception Entry point was not found when invoking a controller's action.

My solution was to insert an assembly binding redirect inside web.config to point at MVC 4 assemblies:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

I don't know the exact cause of the problem, maybe some third party library that still references MVC3.

Davide Icardi
  • 11,919
  • 8
  • 56
  • 77
  • 1
    Unity IoC container for MVC3 (used in MVC4) needs these bindings as well. – hross Sep 24 '13 at 21:12
  • 1
    This solution worked for me. I'd updated to MVC 4, but my binding redirect oldVersion was still pointing at 1.0.0.0-2.0.0.0, and newVersion at 3.0.0.0. Hopefully in the future a more useful error message will indicate that a config entry is the problem, rather than saying the entry point can't be found. – Irish Dec 12 '13 at 16:59
23

The same error appears when you switch you project from MVC3 to MVC4 and forget to change System.Web.WebPages.Razor, Version=1.0.0.0 to System.Web.WebPages.Razor, Version=2.0.0.0 in the web.config.

Liam
  • 27,717
  • 28
  • 128
  • 190
Denis
  • 514
  • 5
  • 8
11

Old post but if you encounter it prior to the mvc woes (System.Mvc.dll update e.g x.0.0.1) you could check the bindingRedirect tag(4.0.0.0 -> 4.0.0.1)

<dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
  </dependentAssembly> 
Ehm
  • 113
  • 1
  • 9
7

If you are catching this error in WebAPI Controller - you need fix binding version of System.Web.Http

<dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
Thomas Bormans
  • 5,156
  • 6
  • 34
  • 51
ZOXEXIVO
  • 920
  • 9
  • 21
3

you should also check that all of the projects in your solutions reference the latest versions of the dll's, and that there are no inconsistent versions being used by different sub-projects.

despite running nuget uninstall, install and update I found the tests project was referencing an old version of the system.net.http

GreyCloud
  • 3,030
  • 5
  • 32
  • 47
3

If you are using .net 4.5 and adding a binder to ModelBinders.Binders collection from a .net 4.0 library you will also get such error.

miyconst
  • 483
  • 4
  • 8
2

Do you have something like this in your Global.asax.cs?

private static void InitializeDependencyInjectionContainer(HttpConfiguration config)
{
    container = new UnityContainer();


    container.RegisterType<Site.Web.Data.IDatabaseFactory, Site.Web.Data.DatabaseFactory>();
    container.RegisterType<Site.Web.Data.Interfaces.IUnitOfWork, Site.Web.Data.UnitOfWork>();
    container.RegisterType<Site.Web.Data.Interfaces.IUserRepository, Site.Web.Data.Repositories.UserRepository>();
    container.RegisterType<Site.Web.Data.Interfaces.ISiteRepository, Site.Web.Data.Repositories.SiteRepository>();

From the stack trace you posted System.Web.Mvc.IDependencyResolver.GetService(Type serviceType) +0 would suggest one (or more) of your dependencies don't resolve.

You could try commenting one or more of them out and try to narrow down which one is failing to resolve.

Jani Hyytiäinen
  • 5,293
  • 36
  • 45
0

Old post but just to add for anyone looking

This seems like a catch all error. I got it when my web.config used an external section and that section was excluded from the Visual Studio project, i.e. using this

<sessionState configSource="SystemWeb.config" />
tony
  • 2,178
  • 2
  • 23
  • 40
0

Try this.. in visual studio go to Package Administrator Console and type:

update-package
Mr. DMX
  • 653
  • 2
  • 9
  • 20
0

I faced this problem and solved it by
1. uninstall-Package Microsoft.AspNet.Mvc (I need to uninstall something else before I can uninstall AspNet.MVC successfully)
2. Install-Package Microsoft.AspNet.Mvc -Version 4.0.20710
3. Rebuild and deploy

Chinh Phan
  • 1,459
  • 19
  • 22
0

Not MVC specific in my case, but had just started getting this error:

Server Error in '/' Application.

Entry point was not found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.EntryPointNotFoundException: Entry point was not found.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[EntryPointNotFoundException: Entry point was not found.]

...

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8008

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0

What caused that was that I had published to the webserver folder from Visual Studio and selected to Precompile the app (using a .NET 4.5 project), with allow precompiled site to be updateable setting btw.

Probably my issue was that the site is running at .NET 4.0 on IIS, whereas the precompiled version placed in bin folder during the publish action was for 4.5. When I removed the "bin" folder from the website it run fine again.

Community
  • 1
  • 1
George Birbilis
  • 2,782
  • 2
  • 33
  • 35
-2

Just update "System.Web.Mvc" with "nuget"

Milad
  • 31
  • 4