Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a webforms 4.0 application that included MVC controller and view through scaffolding. Compiles fine.

On running I get issues AreaRegistration.RegisterAllAreas() in the global.asax.cs

Here is the stack trace....



Could not load file or assembly 'lala' or one of its dependencies. The specified module could not be found.

[FileNotFoundException: Could not load file or assembly 'BusinessObjects.Enterprise.Sdk.ZipLib.netmodule' or one of its dependencies. The specified module could not be found.]
System.Reflection.RuntimeAssembly.GetModules(RuntimeAssembly assembly, Boolean loadIfNotFound, Boolean getResourceModules, ObjectHandleOnStack retModuleHandles) +0
System.Reflection.RuntimeAssembly.GetModulesInternal(Boolean loadIfNotFound, Boolean getResourceModules) +34
System.Reflection.RuntimeAssembly.GetModules(Boolean getResourceModules) +16
System.Reflection.Assembly.GetTypes() +18
System.Web.Mvc.TypeCacheUtil.FilterTypesInAssemblies(IBuildManager buildManager, Predicate`1 predicate) +241
System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies(String cacheName, Predicate`1 predicate, IBuildManager buildManager) +131
System.Web.Mvc.ControllerTypeCache.EnsureInitialized(IBuildManager buildManager) +164
System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(RouteBase route, String controllerName, HashSet`1 namespaces) +91
.................



I can comment out AreaRegistration.RegisterAllAreas( and it will do the same once hitting the route.

I believe the DefaultControllerFactory is using reflection to go through my project, not finding my controller and then searching every referenced assembly which for some reason is confusing it. It's not easy to just start removing assemblies from the project.

I've tried to limit it's searching from suggestion from this link.

Controller lookup and default controller factory[^]
C#
public static void RegisterRoutes(RouteCollection routes)
{
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

      routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "BI.UI.WebApp.Controllers" }
            );
      }
}

Also adding this to the global.asax
C#
ControllerBuilder.Current.DefaultNamespaces.Clear();
ControllerBuilder.Current.DefaultNamespaces.Add("BI.UI.WebApp.Controllers");


........

I verified the controller is in that namespace

C#
namespace BI.UI.WebApp.Controllers
{
    public class DefaultController : Controller
    {
......

What else can anyone suggest to do?
Posted
Comments
virusstorm 12-Jun-15 14:22pm    
I think you are looking down the wrong path. Your error message says it can't load an SAP assembly or one of it dependencies. I don't believe MVC is your problem, I believe you are missing a reference.
Member 11761916 2-Jul-15 12:15pm    
I appreciate it.
Carinda 22-Oct-15 17:49pm    
Hi
Have you found any further information on this. We are have the same problem. We have be trying to contact SAP to solve it. But we are getting no where.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900