thiennn / trymodular

Modular Web Application with ASP.NET Core
MIT License
92 stars 29 forks source link

Modules not loaded #5

Open edwardwilson opened 8 years ago

edwardwilson commented 8 years ago

Hello, I cloned this repository and found that none of the modules are loaded correctly. Can someone tell me if I am missing something which needs to be set up?

thiennn commented 8 years ago

Please post detail the error messages or screenshots

edwardwilson commented 8 years ago

I've downloaded the repository opened and complied. I've ran the app in IISExpress and the site loads fine:

image

However when I click on one of the module links I get a blank page:

image

When I look in the dev tools of my browser it's getting a 404 response:

image

thiennn commented 8 years ago

Did you build the whole solution? Because modules are on different projects that are not referenced by the WebHost, they do not be built automatically.

cevarief commented 7 years ago

Running this on Mac and i get this error :

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Modular.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at Modular.WebHost.Startup.LoadInstalledModules() in /Users/cevarief/Development/aspnet/git/trymodular/Modular/src/Modular.WebHost/Startup.cs:line 188
   at Modular.WebHost.Startup.ConfigureServices(IServiceCollection services) in /Users/cevarief/Development/aspnet/git/trymodular/Modular/src/Modular.WebHost/Startup.cs:line 58
   --- End of inner exception stack trace ---

I find that Modular.Core.dll is already in bin folder.

thiennn commented 7 years ago

The newer version of .net core run don't throw a good exception message. Please try to remove the checking if (ex.Message == "Assembly with same name is already loaded") as I did here https://github.com/simplcommerce/SimplCommerce/blob/master/src/SimplCommerce.WebHost/Extensions/ServiceCollectionExtensions.cs

cevarief commented 7 years ago

Thanks it works now.

I'm wondering if the route can be changed to localhost:5000/moduleA/TestA instead of localhost:5000/TestA/ to avoid routing conflict with core module.

thiennn commented 7 years ago

try AttributeRouting

cevarief commented 7 years ago

Well, attribute Routing is not my preference, since it needs to add it to every module controller. I've just extended the global default route to make it work, the only problem is i could now access both uri /moduleA/TestA and /TestA/. But that's no problem anyway.

Thank you very much.