玻璃映射器 - "The given key was not present in dictionary"
Glass Mapper - "The given key was not present in dictionary"
我们正在尝试为我们的 Sitecore 6.6 实例配置 Glass Mapper,但在测试时遇到了这个错误。
[KeyNotFoundException: The given key was not present in the
dictionary.]
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +13763207
Glass.Mapper.AbstractService..ctor(String contextName) +99
Glass.Mapper.Sc.SitecoreService..ctor(Database database, String contextName) +55
Glass.Mapper.Sc.SitecoreContext..ctor() +98
[Sublayout].Page_Load(Object sender, EventArgs e) in [Sublayout].ascx.cs:18
System.Web.UI.Control.OnLoad(EventArgs e) +109
System.Web.UI.Control.LoadRecursive() +68
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+4498
调用它的代码是
protected void Page_Load(object sender, EventArgs e)
{
var context = new SitecoreContext();
Model = context.GetCurrentItem<Article>();
}
Version 3.3.1.53
已安装(因为我们的 Sitecore 版本在 4.x 版本上存在问题)
当上下文未正确加载时,可能会发生这种情况。
确保您部署了 Glass 附带的所有配置,例如:
Website\App_Config\Include\Glass.Mapper.Sc.CastleWindsor.config
还要确保您复制了 Glass Installation 附带的所有 .dll。
我们正在尝试为我们的 Sitecore 6.6 实例配置 Glass Mapper,但在测试时遇到了这个错误。
[KeyNotFoundException: The given key was not present in the dictionary.] System.Collections.Generic.Dictionary`2.get_Item(TKey key) +13763207 Glass.Mapper.AbstractService..ctor(String contextName) +99 Glass.Mapper.Sc.SitecoreService..ctor(Database database, String contextName) +55 Glass.Mapper.Sc.SitecoreContext..ctor() +98 [Sublayout].Page_Load(Object sender, EventArgs e) in [Sublayout].ascx.cs:18 System.Web.UI.Control.OnLoad(EventArgs e) +109 System.Web.UI.Control.LoadRecursive() +68 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Control.LoadRecursive() +165 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4498
调用它的代码是
protected void Page_Load(object sender, EventArgs e)
{
var context = new SitecoreContext();
Model = context.GetCurrentItem<Article>();
}
Version 3.3.1.53
已安装(因为我们的 Sitecore 版本在 4.x 版本上存在问题)
当上下文未正确加载时,可能会发生这种情况。
确保您部署了 Glass 附带的所有配置,例如:
Website\App_Config\Include\Glass.Mapper.Sc.CastleWindsor.config
还要确保您复制了 Glass Installation 附带的所有 .dll。