小编meh*_*ker的帖子

Unity和Random"索引超出了数组的范围"异常

我们运行的网站有大约15.000个实时用户(谷歌分析)(大约1000个请求/秒(性能计数器)).

我们有两个Web服务器后面的负载均衡器.

有时每天有时每周一次我们的Web服务器停止执行请求并开始响应错误,每个请求都记录异常:"System.IndexOutOfRangeException - Index超出了数组的范围."

我们的环境:IIS 8.5,.Net 4.5.0,Mvc 5.1.0,Unity 3.5(与3.0相同),WebActivatorEx 2.0在IIS中,工作进程1和其他设置具有默认值.

我们无法捕捉到任何特定情况造成此错误.应用程序池回收后,一切都没有问题.在每个请求响应错误之前,没有任何与之相关的错误.

过去有一个问题与相关的旧Unity版本有关:https : //unity.codeplex.com/discussions/328841 http://unity.codeplex.com/workitem/11791 看不到我能做些什么.

这里有异常细节:

System.IndexOutOfRangeException
Index was outside the bounds of the array.

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Practices.Unity.NamedTypesRegistry.RegisterType(Type t, String name)
   at Microsoft.Practices.Unity.UnityDefaultBehaviorExtension.OnRegisterInstance(Object sender, RegisterInstanceEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Microsoft.Practices.Unity.UnityContainer.RegisterInstance(Type t, String name, Object instance, LifetimeManager lifetime)
   at Microsoft.Practices.Unity.UnityContainerExtensions.RegisterInstance[TInterface](IUnityContainer container, TInterface instance, LifetimeManager lifetimeManager)
   at DemoSite.News.Portal.UI.App_Start.UnityConfig.<>c__DisplayClass1.<RegisterTypes>b__0() …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc dependency-injection ioc-container inversion-of-control unity-container

4
推荐指数
1
解决办法
2581
查看次数