Entry point not found exception in MVC2 app

1,045 views
Skip to first unread message

Aaron Powell

unread,
Mar 31, 2010, 2:02:52 AM3/31/10
to aut...@googlegroups.com
I've just upgraded an ASP.NET MVC 1 application to using MVC 2, and also upgrade from Autofac 1.4 to the 2.1 (current release).
I'm still using .NET 3.5.

Since doing so I'm receiving an EntryPointNotFoundException from application startup. I've done rebuilds, etc so I know it's not cached assemblies.
The only thing that's leading me to think it's a problem caused by Autofac is that if I remove the HTTP model (and all bindings) I get execution (until the point that I try and load something via Autofac anyway :P).

Here's the stack trace (although it's quite unhelpful):

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.IControllerFactory.CreateController(RequestContext requestContext, String controllerName) +0
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +111
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +46
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +63
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +13
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8679426
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


--
Aaron Powell
Umbraco Ninja

www.aaron-powell.com

Roelof Blom

unread,
Mar 31, 2010, 5:52:33 AM3/31/10
to aut...@googlegroups.com
Aaron,

Make sure you have the necessary binding redirect for MVC2 in your Web.config file, this is a common oversight when upgrading from MVC v1.

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

-- Roelof.


--
You received this message because you are subscribed to the Google Groups "Autofac" group.
To post to this group, send email to aut...@googlegroups.com.
To unsubscribe from this group, send email to autofac+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/autofac?hl=en.

mthird

unread,
Mar 31, 2010, 7:45:40 AM3/31/10
to Autofac
That should probably resolve it, but if it doesn't try clearing your
ASP.NET temporary files cache. One of our developers had a similar
issue and was due to stale files in the cache.

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

On Mar 31, 5:52 am, Roelof Blom <roelof.b...@gmail.com> wrote:
> Aaron,
>
> Make sure you have the necessary binding redirect for MVC2 in your
> Web.config file, this is a common oversight when upgrading from MVC v1.
>
> <configuration> <runtime> <assemblyBinding
> xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly>
> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
> <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
>
> -- Roelof.
>
>
>
> On Wed, Mar 31, 2010 at 8:02 AM, Aaron Powell <m...@aaron-powell.com> wrote:
> > I've just upgraded an ASP.NET MVC 1 application to using MVC 2, and also
> > upgrade from Autofac 1.4 to the 2.1 (current release).
> > I'm still using .NET 3.5.
>
> > Since doing so I'm receiving an EntryPointNotFoundException from
> > application startup. I've done rebuilds, etc so I know it's not cached
> > assemblies.
> > The only thing that's leading me to think it's a problem caused by Autofac
> > is that if I remove the HTTP model (and all bindings) I get execution (until
> > the point that I try and load something via Autofac anyway :P).
>
> > Here's the stack trace (although it's quite unhelpful):

> > *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.IControllerFactory.CreateController(RequestContext requestContext, String controllerName) +0
> >    System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +111
> >    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +46
> >    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +63

> >    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest( HttpContext context, AsyncCallback cb, Object extraData) +13
> >    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionSt ep.Execute() +8679426


> >    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
>
> > --
> > Aaron Powell
> > Umbraco Ninja
>
> >www.aaron-powell.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Autofac" group.
> > To post to this group, send email to aut...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > autofac+u...@googlegroups.com<autofac%2Bunsu...@googlegroups.com >

Aaron Powell

unread,
Apr 5, 2010, 6:43:57 PM4/5/10
to Autofac
I've done quite a bit more investigation into this and I've got closer
to finding the problem.

(For the record I did have the assembly binding set up)

The EntryPointNotFoundException actually comes from something slightly
different, the cause is that Autofac isn't resolving my controller
(from CreateController in AutofacControllerFactory). I'm doing
builder.RegisterControllers(Assembly.GetExecutingAssembly()) like the
documentation says, but when I look at the resolved types none of my
controllers are there.

I've created my own module which I explicitly registered my
controllers, but this resulted in the same error (I'm guessing it was
due to the naming of the controller server, but I'm not really sure),
so I then created my own IControllerFactory implementation, which
worked just fine.
Oddly enough my IControllerFactory is exactly the same source code as
the AutofacControllerFactory :(

From everything I can work out there seems to be some kind of a
problem with Autofac finding my controllers, the problem is I can't
get the source to compile for .NET 3.5 (I've downloaded the trunk and
followed the wiki guide for compiling the source) so I can't answer
the following question:
* How does Autofac determine the types in the assembly?

I've dug into ScanningRegistrationExtensions.RegisterAssemblyTypes but
I can't work out * truly* how that's dealing with my types (the ctor
selection and the like).

Aaron Powell

unread,
Apr 6, 2010, 1:53:12 AM4/6/10
to Autofac
I've done some more investigation into this problem and it's coming
from the fact that none of my controllers are being registered when I
do:
builder.RegisterControllers(Assembly.GetExecutingAssembly());

(yes, they are in that assembly :P)

I wrote my own module to register the controllers (which is a lot more
simple than the autofac one) and that registered them, but when I used
the AutofacControllerFactory it still failed, as it was unable to
resolve the references
(_containerProvider.RequestLifetime.TryResolve(controllerService, out
controller) returns false), which resulted in the HttpException being
thrown.

I decided to create my own IControllerFactory implementation, copied
the code out of the Autofac one and it worked fine.

For some reason I can't seem to compile the source for Autofac either
(I followed the wiki doco for 3.5 compilation and it fails as the
compiler flag doesn't seem to get set still) so I can't debug it.
And this is leaving me very confused as the way Autofac wires up the
types in the assembly (it's ctor selector and such) is really doing my
head in.

Anyone had problems compiling the trunk?
Are there any conventions I need to do for defining controllers?

On Mar 31, 4:02 pm, Aaron Powell <m...@aaron-powell.com> wrote:
> I've just upgraded an ASP.NET MVC 1 application to using MVC 2, and also
> upgrade from Autofac 1.4 to the 2.1 (current release).
> I'm still using .NET 3.5.
>
> Since doing so I'm receiving an EntryPointNotFoundException from application
> startup. I've done rebuilds, etc so I know it's not cached assemblies.
> The only thing that's leading me to think it's a problem caused by Autofac
> is that if I remove the HTTP model (and all bindings) I get execution (until
> the point that I try and load something via Autofac anyway :P).
>
> Here's the stack trace (although it's quite unhelpful):

> *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:*

Aaron Powell

unread,
Apr 5, 2010, 9:09:56 PM4/5/10
to Autofac, m...@aaron-powell.com
I've done some more investigation into this problem and it's coming
from the fact that none of my controllers are being registered when I
do:
builder.RegisterControllers(Assembly.GetExecutingAssembly());

(yes, they are in that assembly :P)

I wrote my own module to register the controllers (which is a lot more
simple than the autofac one) and that registered them, but when I used
the AutofacControllerFactory it still failed, as it was unable to
resolve the references
(_containerProvider.RequestLifetime.TryResolve(controllerService, out
controller) returns false), which resulted in the HttpException being
thrown.

I decided to create my own IControllerFactory implementation, copied
the code out of the Autofac one and it worked fine.

For some reason I can't seem to compile the source for Autofac either
(I followed the wiki doco for 3.5 compilation and it fails as the
compiler flag doesn't seem to get set still) so I can't debug it.
And this is leaving me very confused as the way Autofac wires up the
types in the assembly (it's ctor selector and such) is really doing my
head in.

Anyone had problems compiling the trunk?
Are there any conventions I need to do for defining controllers?

Nicholas Blumhardt

unread,
Apr 9, 2010, 4:49:01 PM4/9/10
to aut...@googlegroups.com
For anyone following this issue, Aaron has blogged about the cause and solution here: http://www.aaron-powell.com/problems-with-assembly-trust (assembly trust issues.)

Cheers,
Nick

To unsubscribe from this group, send email to autofac+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages