Error in medium trust: Found no controller for type [...] among 0 found controllers.

Topics: Developer Forum
Jan 29, 2009 at 11:48 PM
Hi,

I've been playing around with the Mvc_Example site - managed to get it running happily locally (VS dev server) after I re-compiled the N2.Extensions class against the ASP.NET MVC release candidate.

I've also got the site working with a local SQL Server database file (rather than the SQLite one), again on my dev environment.

However, I've now thrown the site up to a host, to see how I get on there, including deploying the ASP.NET MVC dlls and I get the following error:

Server Error in '/' Application.

Found no controller for type 'N2.Edit.Trash.TrashContainerItem' among 0 found controllers.

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: N2.N2Exception: Found no controller for type 'N2.Edit.Trash.TrashContainerItem' among 0 found controllers.

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:

[N2Exception: Found no controller for type 'N2.Edit.Trash.TrashContainerItem' among 0 found controllers.]
   N2.Web.Mvc.ContentRoute.GetControllerFor(Type itemType, IList`1 controllerDefinitions) +585
   N2.Web.Mvc.ContentRoute..ctor(IEngine engine, IRouteHandler routeHandler) +254
   MvcTest.GlobalApplication.RegisterRoutes(RouteCollection routes, IEngine engine) in C:\Users\Ben\Documents\Visual Studio 2008\Projects\Example_Mvc\wwwroot\Global.asax.cs:14
   MvcTest.GlobalApplication.Init() in C:\Users\Ben\Documents\Visual Studio 2008\Projects\Example_Mvc\wwwroot\Global.asax.cs:25
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +642


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 <!-- [N2Exception]: Found no controller for type 'N2.Edit.Trash.TrashContainerItem' among 0 found controllers. at N2.Web.Mvc.ContentRoute.GetControllerFor(Type itemType, IList`1 controllerDefinitions) at N2.Web.Mvc.ContentRoute..ctor(IEngine engine, IRouteHandler routeHandler) at MvcTest.GlobalApplication.RegisterRoutes(RouteCollection routes, IEngine engine) in C:\Users\Ben\Documents\Visual Studio 2008\Projects\Example_Mvc\wwwroot\Global.asax.cs:line 14 at MvcTest.GlobalApplication.Init() in C:\Users\Ben\Documents\Visual Studio 2008\Projects\Example_Mvc\wwwroot\Global.asax.cs:line 25 at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) --><!-- This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->

I was getting something similar in my local environment and came across a recommendation to "reference NHibernate", which i did in the project, built and deployed happily.

I've copied up the NHibernate, Castle, Log4Net, etc dlls to the server, but to no avail - has anyone else seen this, or know what I'm doing wrong?

I'm not all that versed in NHibernate/Castle just yet.

Thanks,

Zhaph
Coordinator
Jan 30, 2009 at 8:53 PM
This could be a trust related issue. Are the assemblies in your solution registered in the n2 configuration section? Here's an example.