【发布时间】: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