MvcSiteMapProvider未将痕迹显示为链接和路线

时间:2016-05-23 14:34:28

标签: c# asp.net asp.net-mvc mvcsitemapprovider

我使用MvcSiteMapProvider和ASP NET MVC 5来解决这个问题。

有时,当部署应用程序时(使用发布模式),面包屑链接会断开,并且它不会显示,如下图所示:

预期: http://s33.postimg.org/oop4ua3tb/breabcrumb_funcionando_mapeamentocampo.png

断开的链接2:http://s33.postimg.org/yjga0i7rj/breadcrumb_mapeamento_de_campo.png

这是站点地图文件:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0"
            xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">

  <mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="Processos" controller="Processo" action="Index" key="Processo">
      <mvcSiteMapNode title="Alterar Processo" controller="Processo" action="Alterar" preservedRouteParameters="Id" />
    </mvcSiteMapNode>
    <mvcSiteMapNode title="Importar Processos" controller="ImportarProcessos" action="ImportarProcessos">
      <mvcSiteMapNode title="Histórico de Importação" controller="ImportarProcessos" action="HistoricoImportacao" />
      <mvcSiteMapNode title="Histórico de Inconsistências" controller="ImportarProcessos" action="HistoricoInconsistencia" />
    </mvcSiteMapNode>
    <mvcSiteMapNode title="Meus Dados" controller="Conta" action="MeusDados" />
    <mvcSiteMapNode title="Parâmetros Gerais" controller="ParametroGeral" action="Index" />
    <mvcSiteMapNode title="Regras de Validação" controller="RegraValidacao" action="Index" />
    <mvcSiteMapNode title="Mapeamento dos Campos" controller="MapeamentoCampo" action="Index" />
    <mvcSiteMapNode title="Módulos Externos" controller="ModuloExterno" action="Index" key="ModuloExternoPai">
      <mvcSiteMapNode title="ConfigurarModulo" controller="ModuloExterno" action="ConfigurarModulo" preservedRouteParameters="Id" />
    </mvcSiteMapNode>
    <mvcSiteMapNode title="Usuários" controller="Usuario" action="Index" key="Usuario">
      <mvcSiteMapNode title="Registrar" controller="Usuario" action="Registrar" />
      <mvcSiteMapNode title="AlterarUsuario" controller="Usuario" action="Editar" preservedRouteParameters="Id" />
    </mvcSiteMapNode>
    <mvcSiteMapNode title="Lista Negra de Senhas" controller="ListaNegraSenha" action="Index" key="ListaNegraSenha">
      <mvcSiteMapNode title="Registrar" controller="ListaNegraSenha" action="Registrar" />
      <mvcSiteMapNode title="AlterarSenha" controller="ListaNegraSenha" action="Editar" preservedRouteParameters="Id" />
    </mvcSiteMapNode>
    <mvcSiteMapNode title="Relatório de Log" controller="RelatorioLogger" action="RelatorioLogger" />
    <mvcSiteMapNode title="Sobre" controller="Home" action="Sobre" />
  </mvcSiteMapNode>
</mvcSiteMap>

这是用于呈现Breadcrumb的视图中的代码:

   <div class="breadcrumb">
            <span>@LabelsResources.BreadCrumbsMessage @Html.MvcSiteMap().SiteMapPath()</span>
        </div>

我们已尝试在解决方案文件夹中部署站点地图文件,但它也不起作用。

有人遇到同样的问题并知道如何解决它吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

最好的猜测是/Views/Shared/DisplayTemplates/文件夹中MvcSiteMapProvider文件夹中用于呈现HTML(即SiteMapPathHelperModel.cshtmlSiteMapNodeModel.cshtml)的文件未包含在部署中已经以某种方式修改了呈现节点的键而不是链接层次结构。