【问题标题】:ASP.NET MVC 5 using Ninject | The SiteMapLoader has not been initializedASP.NET MVC 5 使用 Ninject | SiteMapLoader 尚未初始化
【发布时间】:2016-03-01 22:00:52
【问题描述】:

我正在使用 Visual Studio 2013 并在 MVC 5 中打开了一个项目。 我想在我的网站上有动态面包屑。 我搜索了谷歌,在stackoverflow上找到了与我相关的问题。

http://stackoverflow.com/questions/1066777/how-can-dynamic-breadcrumbs-be-achieved-with-asp-net-mvc

所以我选择了SiteMapProvider,我使用 nuget 安装了该软件包,但安装后我收到以下错误。

The SiteMapLoader has not been initialized.

Check the 'MvcSiteMapProvider_UseExternalDIContainer' setting in the AppSettings section of web.config.

If the setting is set to 'false', you will need to call the MvcSiteMapProvider.DI.Composer.Compose() method at the end of Application_Start in the Global.asax file. Alternatively, if you are using .NET 4.0 or higher you can install the MvcSiteMapProvider.MVCx NuGet package corresponding to your MVC version.

If the setting is set to 'true', you must set the SiteMaps.Loader property during Application_Start in Global.asax to an instance of the built-in SiteMapLoader type or a custom ISiteMapLoader instance. This can be achieved most easily by using your external DI container.

Ninject 也已安装。我不确定为什么会收到错误消息。我没有做任何设置只安装。

在下面的链接中不需要设置。

http://maartenba.github.io/MvcSiteMapProvider/getting-started.html

如何修复此错误并使面包屑导航正常工作。

【问题讨论】:

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


    【解决方案1】:

    我遇到了类似的问题,通过安装 MvcSiteMapProvider.MVC5.DI.Ninject 包解决了它

    https://www.nuget.org/packages/MvcSiteMapProvider.MVC5.DI.Ninject/

    要将 Ninject 与 MvcSiteMapProvider 一起使用,需要此包安装的一些配置和类。

    我也没有做任何配置,在第一次运行时为我工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-10
      • 1970-01-01
      • 1970-01-01
      • 2022-11-01
      • 1970-01-01
      • 2014-09-04
      相关资源
      最近更新 更多