1
When posting the site on iis 7.5, this error occurs when trying to open the site:
Multiple types Were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') 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.
How to solve ?
Code Routeconfig:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Código Controller:
@{
ViewBag.Title = "Controle de documentos";
}
@section featured {
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<!--<h2>@*ViewBag.Message*@</h2>-->
</hgroup>
<p>
Este módulo foi desenvolvido para o envio e controle de documentos do portal.
</p>
<p>
@if (HttpContext.Current.User.Identity.IsAuthenticated)
{
@Html.ActionLink("Calendário de documentos", "Index", "CalendarioAlertaSMS");
}
else{
@Html.ActionLink("Logar", "LogOn", "Conta");
}
</p>
</div>
</section>
}
This code you posted is from the view... in the controller folder, it must have a file called homeController.Cs.
– RSinohara