gpt4 book ai didi

c# - 如何调试CaSTLe Windsor安装/注册异常

转载 作者:太空狗 更新时间:2023-10-29 20:39:32 24 4
gpt4 key购买 nike

我的团队前段时间尝试开始使用 CaSTLe Windsor (3.2.0) 以实现 IoC 优势。我们在开发机器上的试运行很顺利,但是当我们尝试在生产服务器上运行代码时,失败并出现以下异常

Application: XXXX  
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at System.Signature.GetSignature(Void*, Int32, System.RuntimeFieldHandleInternal, System.IRuntimeMethodInfo, System.RuntimeType)
at System.Reflection.RuntimeMethodInfo.get_Signature()
at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
at Castle.MicroKernel.ModelBuilder.Inspectors.PropertiesDependenciesModelInspector.IsValidPropertyDependency(System.Reflection.PropertyInfo)
at System.Linq.Enumerable+WhereArrayIterator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at Castle.MicroKernel.ModelBuilder.Inspectors.PropertiesDependenciesModelInspector.InspectProperties(Castle.Core.ComponentModel)
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ForEach(System.Action`1<System.__Canon>)
at Castle.MicroKernel.ModelBuilder.DefaultComponentModelBuilder.BuildModel(Castle.MicroKernel.ModelBuilder.IComponentModelDescriptor[])
at Castle.MicroKernel.Registration.ComponentRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Castle.MicroKernel.Registration.IRegistration.Register(Castle.MicroKernel.IKernelInternal)
at Castle.MicroKernel.DefaultKernel.Register(Castle.MicroKernel.Registration.IRegistration[])
at Castle.Windsor.WindsorContainer.Register(Castle.MicroKernel.Registration.IRegistration[])
at Sproom.Web.Infrastructure.WindsorInstaller.Install(Castle.Windsor.IWindsorContainer, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore)
at Castle.Windsor.Installer.AssemblyInstaller.Install(Castle.Windsor.IWindsorContainer, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore)
at Castle.Windsor.Installer.CompositeInstaller.Install(Castle.Windsor.IWindsorContainer, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore)
at Castle.Windsor.WindsorContainer.Install(Castle.MicroKernel.Registration.IWindsorInstaller[], Castle.Windsor.Installer.DefaultComponentInstaller)
at Castle.Windsor.WindsorContainer.Install(Castle.MicroKernel.Registration.IWindsorInstaller[])

这对我们来说是个亮点,事实证明很难用谷歌搜索。我最近有时间来解决这个问题,并成功地将其调试到一个组件在 MVC 3 dll 上具有显式引用/依赖项(C#,而不是 windsor)这一事实。该服务器是新委托(delegate)的服务器,只安装了 MVC 4。所有开发箱都安装了 MVC 3,这使得该问题只能在生产环境中重现。

我通过二进制注释组件注册代码,将批量注册转换为按组件注册,然后盯着有问题的组件进行调试,直到我点击了正确的位置并顿悟。

我现在的问题是,有没有更好的方法可以调试它?我可以让 Windsor 提供更好的信息吗?为什么在正常的非温莎情况下这不是温莎的问题?我和团队现在对使用 Windsor 有点怀疑,因为不可谷歌搜索的错误只能在生产中重现,所以我希望我错过了一些解决这个问题的好方法。

最佳答案

这个答案可能会帮助您在调试时获得更好的信息:https://stackoverflow.com/a/9539679/1158735

关于c# - 如何调试CaSTLe Windsor安装/注册异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19607351/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com