Sitecore 8:删除语言导致KeyNotFoundException异常

Sitecore 8:删除语言导致KeyNotFoundException异常,sitecore,sitecore8,Sitecore,Sitecore8,我已经从sitecore中删除了“丹麦语”。在我的解决方案中,我遇到了一个异常,我曾经使用过代码Sitecore.Context.Language.Name 这是个例外 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and

我已经从sitecore中删除了“丹麦语”。在我的解决方案中,我遇到了一个异常,我曾经使用过代码
Sitecore.Context.Language.Name

这是个例外

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
整个堆栈跟踪

Source Error: 
Line 22:         static Model.Localization.CommonDictionary GetCommonLocalizations()
Line 23:         {
Line 24:             return Dictionary[Sitecore.Context.Language.Name];
Line 25:         }
Line 26:         public static string DefaultActivityTitle { get { return GetCommonLocalizations().DefaultActivityTitle; } }

Source File:  E:\IIS Data\MySite\Utilities\SF.ISK.Kernel\Localisation\CommonDictionary.cs    Line:  24 

Stack Trace: 
[KeyNotFoundException: The given key was not present in the dictionary.]
   System.Collections.Generic.Dictionary`2.get_Item(TKey key) +13763207
   SF.ISK.Kernel.Localisation.CommonDictionary.GetCommonLocalizations() in E:\IIS Data\MySite\Utilities\SF.ISK.Kernel\Localisation\CommonDictionary.cs:24
   SF.ISK.Kernel.Localisation.CommonDictionary.get_HtmlTitleTemplate() in E:\IIS Data\MySite\Utilities\SF.ISK.Kernel\Localisation\CommonDictionary.cs:136
   SF.ISK.Website.layouts.ISK.ISKMainPageLayout.GetPageTitle() in E:\IIS Data\MySite\Website\layouts\ISK\ISK.MainPage.aspx.cs:51
   SF.ISK.Website.layouts.ISK.ISKMainPageLayout.Page_Load(Object sender, EventArgs e) in E:\IIS Data\MySite\Website\layouts\ISK\ISK.MainPage.aspx.cs:41
   System.Web.UI.Control.OnLoad(EventArgs e) +109
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4498

如果用
返回字典[“en”]替换上述代码中的那么我就不知道错误了。

您的物品可能有一个da dk版本。删除da dk版本并发布


可能是在查找已删除的da dk时,sitecore找不到此密钥。

您的项目可能有da dk版本。删除da dk版本并发布


可能是在查找已删除的da dk时,sitecore找不到该密钥。

可以发布整个堆栈跟踪吗?
sitecore.Context.Language.Name的值是多少?是不是
da da
?尝试调试并查看是的,它仍然为我提供
da
。这意味着
Sitecore.Context.Items[“sc\u Language”]
设置为
da
,或者您的站点
lang
cookie被设置为
da
或者站点默认语言被设置为
da
或者
DefaultLanguage
设置被设置为
da
或者您在语言切换器块内。我如何在Sitecore 8中检查/设置默认语言?您可以发布整个堆栈跟踪吗?以及
Sitecore.Context.Language.Name
?是不是
da da
?尝试调试并查看是的,它仍然为我提供
da
。这意味着
Sitecore.Context.Items[“sc\u Language”]
设置为
da
,或者您的站点
lang
cookie被设置为
da
,或者站点默认语言被设置为
da
,或者
DefaultLanguage
设置被设置为
da
,或者您在语言切换器块中。如何在Sitecore 8中检查/设置默认语言?