Reputation: 181
We're trying to configure Glass Mapper for our Sitecore 6.6 instance but came across this error when testing it out.
[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
and the code calling this is
protected void Page_Load(object sender, EventArgs e)
{
var context = new SitecoreContext();
Model = context.GetCurrentItem<Article>();
}
Version 3.3.1.53
is installed (as we had issues with our version of Sitecore on 4.x versions)
Upvotes: 0
Views: 1365
Reputation: 1879
This might happen when context hasn't been loaded properly.
Make sure you deployed all the config's that comes with Glass eg:
Website\App_Config\Include\Glass.Mapper.Sc.CastleWindsor.config
Also make sure you copied across all the .dll's that comes with Glass Installation.
Upvotes: 0