Searching the internet I found a similar problem, but mine occurs only with nodes in other areas of the project.
Error
Could not resolve URL for sitemap node Carta de Interveniência which represents action carta_interveniencia in controller processo. Ensure that the route for this sitemap node can be resolved and that its default values allow resolving the URL for the current sitemap node.
Sitemap
<mvcSiteMapNode title="Cadastros" clickable="false" roles="*" >
<mvcSiteMapNode title="Processos" controller="processos" action="index">
<mvcSiteMapNode title="Novo" action="novo" />
<mvcSiteMapNode title="Editar" action="editar" dynamicNodeProvider="CreditoImobiliarioBB.Web.Infra.Sitemap.ProcessosDynamicNodeProvider, CreditoImobiliarioBB.Web" />
<mvcSiteMapNode title="Detalhes" action="detalhes" preservedRouteParameters="id" dynamicNodeProvider="CreditoImobiliarioBB.Web.Infra.Sitemap.ProcessosDynamicNodeProvider, CreditoImobiliarioBB.Web">
<mvcSiteMapNode title="Documentos" key="ProcessoDocumentos2" clickable="false" area="Documentos" controller="processo">
<mvcSiteMapNode title="Carta de Interveniência" preservedRouteParameters="id" action="carta_interveniencia"></mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMapNode>
Area registration
public class DocumentosAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Documentos";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: "Documentos",
url: "{controller}/{id}/documento/{action}",
defaults: null,
constraints: new { id = @"^\d+$" },
namespaces: new string[] { "CreditoImobiliarioBB.Web.Areas.Documentos" }
);
}
}
The default implementation of the resolver behaves this way. It tries to locate the route based off exactly what you have in your sitemap. Since your sitemap does not have the id parameter and you have a constraint on that, the route is not found and the resolver throws an exception. However, there is no real reason the resolver has to resolve every URL when it loads the sitemap.
You can create your own resolver and register that with the sitemap. Copy and paste the default one into your own class. Near the bottom of the default code is this:
Change that code to this: