已存在具有相同密钥的条目

时间:2016-02-16 07:28:05

标签: c# umbraco7

我正在Umbraco 7建立一个网站。我在7.3.x上现在更新到7.4.0。在随机的场合,网站将会中断,我将收到以下消息。

 [ArgumentException: An entry with the same key already exists.]
   System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
   System.Collections.Generic.SortedList`2.Add(TKey key, TValue value) +6744873
   Umbraco.Core.MainDom.Register(Action install, Action release, Int32 weight) +128
   Umbraco.Core.Sync.DatabaseServerMessenger.Boot() +55
   Umbraco.Web.BatchedDatabaseServerMessenger.Startup() +186
   Umbraco.Web.BatchedDatabaseServerMessengerStartup.ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +63
   Umbraco.Core.ApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +37
   Umbraco.Core.CoreBootManager.<Complete>b__a(IApplicationEventHandler x) +230
   Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) +141
   Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) +293
   Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) +60
   Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +234
   Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e) +34

我缩小了这个问题,它与检查指数有关。在开发环境中,我只需要重建并且工作正常但在测试中我们需要停止应用程序池删除检查索引并重新启动。

我也从日志中得到了这个

2016-02-16 08:12:50,006 [P4656/D62/T1] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
 2016-02-16 08:12:50,051 [P4656/D62/T1] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
 2016-02-16 08:12:50,051 [P4656/D62/T1] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
 2016-02-16 08:12:50,072 [P4656/D62/T1] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
 2016-02-16 08:12:50,072 [P4656/D62/T1] ERROR Umbraco.Core.CoreBootManager - An error occurred running OnApplicationStarted for handler Umbraco.Web.BatchedDatabaseServerMessengerStartup
System.ArgumentException: An entry with the same key already exists.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
   at Umbraco.Core.MainDom.Register(Action install, Action release, Int32 weight)
   at Umbraco.Core.Sync.DatabaseServerMessenger.Boot()
   at Umbraco.Web.BatchedDatabaseServerMessenger.Startup()
   at Umbraco.Web.BatchedDatabaseServerMessengerStartup.ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
   at Umbraco.Core.ApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
   at Umbraco.Core.CoreBootManager.<Complete>b__a(IApplicationEventHandler x)
 2016-02-16 08:12:50,074 [P4656/D62/T1] ERROR Umbraco.Core.UmbracoApplicationBase - An unhandled exception occurred
System.ArgumentException: An entry with the same key already exists.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
   at Umbraco.Core.MainDom.Register(Action install, Action release, Int32 weight)
   at Umbraco.Core.Sync.DatabaseServerMessenger.Boot()
   at Umbraco.Web.BatchedDatabaseServerMessenger.Startup()
   at Umbraco.Web.BatchedDatabaseServerMessengerStartup.ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
   at Umbraco.Core.ApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
   at Umbraco.Core.CoreBootManager.<Complete>b__a(IApplicationEventHandler x)
   at Umbraco.Core.EnumerableExtensions.ForEach[TItem](IEnumerable`1 items, Action`1 action)
   at Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete)
   at Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete)
   at Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e)
   at Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e)

我已经读过这可能与重复的用户有关,但数据库中没有这样的东西。

可能导致此问题的另一个问题是开发站点和测试站点共享相同的Umbraco数据库。我不确定这是否会引发这种冲突。

无论如何,我对这个错误感到很困惑,任何帮助都会受到高度赞赏,因为它非常重要。

提前致谢,Vasilis

1 个答案:

答案 0 :(得分:1)

可以共享数据库,但您需要将其设置为负载平衡环境。 (高速缓存)

按照指南操作 https://our.umbraco.org/documentation/Getting-Started/Setup/Server-Setup/load-balancing/