When you publish the site in iis 7.5, this error occurs when you try 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?
RouteConfig code:
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>
}