title: Glass Mapper - "The given key was not present in dictionary"
body: <p>We're trying to configure Glass Mapper for our Sitecore 6.6 instance but came across this error when testing it out.</p>
  
  <blockquote>
    <p>[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</p>
  </blockquote>
  
  <p>and the code calling this is</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          var context = new SitecoreContext();
          Model = context.GetCurrentItem&lt;Article&gt;();
      }
  </code></pre>
  
  <p><code>Version 3.3.1.53</code> is installed (as we had issues with our version of Sitecore on 4.x versions)</p>