ChrisHammond / DNNTemplates

Christoc's DotNetNuke Extension Development templates for Visual Studio
http://www.christoc.com/Products/DNN-Development-Templates
Other
97 stars 38 forks source link

The controller for path '/Default.aspx' was not found or does not implement IController. #77

Open lmakue opened 2 years ago

lmakue commented 2 years ago

Hi We have created many MVC modules using the DNN MVC Template and all deployed into the same Evoq instance In the past we used to have issues with implementations stating clash with ItemController from multiple modules as DNN would not know which to use Solution is then to make use of the RouteConfig & setup the routing accordingly

However when we implement custom routing by adding the RouteConfig file example below

public class RouteConfig : IMvcRouteMapper { public void RegisterRoutes(IMapRoute mapRouteManager) { mapRouteManager.MapRoute( "DNNPharmSelection", "DNNPharmSelection", "{controller}/{action}", new[] {"Netcare.Dnn.Modules.DNNPharmSelection.Controllers"}); } }

we then get the error below

DotNetNuke.Services.Exceptions.ModuleLoadException: The controller for path '/Default.aspx' was not found or does not implement IController. ---> System.Web.HttpException: The controller for path '/Default.aspx' was not found or does not implement IController.

We have tried many different variations of naming and options but still get the same error when deploying. All modules are located in the "DesktopModules/MVC" folder the .dnn file has also been edited to point to the custom controller as below

"Netcare.Dnn.Modules.DNNPharmSelection.Controllers/Provider/Index.mvc"

Controller as below

namespace Netcare.Dnn.Modules.DNNPharmSelection.Controllers { [DnnHandleError] public class ProviderController : DnnController {

    public ProviderController() { }

    public ActionResult Index()
    {
        return View();
    }

}

}

no extra code added just the basic creation of a new controller to not clash with any default ItemControllers, Also note that this error fires even without a custom controller when the custom RoutConfig is added

Steps we follow- Create new VS2019 project using the DNN MVC Template Create New Controller implementing DNNController Update the .dnn file to point to new controller Create & Add the RouteConfig File Buid & Deploy to Evoq instance Error then happens

Without the routeconfig it will state the below DotNetNuke.Services.Exceptions.ModuleLoadException: Multiple types were found that match the controller named 'Item'. This can happen if the route that services this request does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.

Issue happens with custom or default item controller & we are stuck as to what could be the issue

i hope i have given enough information

Please let me know what can be checked