加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – Castle Windsor 3.1缺失方法例外

发布时间:2020-12-15 21:44:44 所属栏目:百科 来源:网络整理
导读:试图从测试组件安装我所有的单独安装程序一直在投掷 "`{"Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration1!0 Castle.MicroKernel.Registration.ComponentRegistration1.DependsOn(Castle.MicroKernel.Registration.Dependency)'.
试图从测试组件安装我所有的单独安装程序一直在投掷

"`{"Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration1<!0> Castle.MicroKernel.Registration.ComponentRegistration1.DependsOn(Castle.MicroKernel.Registration.Dependency)'."}`"

尽管代码从Console应用程序/ Windsows服务完美运行,但两个项目的引用完全相同:

Castle.Core
Castle.Facilities.FactorySupport
Castle.Facilities.Logging
Castle.Facilities.QuartzIntegration
Castle.Services.Logging.NLogIntegration
Castle.Windsor

有没有人知道为什么测试组件如此调用windsor容器的构建:

this.Container = new WindsorContainer(new XmlInterpreter())
       .Install(FromAssembly.Named("Assembly.WindowsService",new CustomWindsorInstallerFactory()));

在引用“DependsOn”方法的任何代码上失败,例如:

container.Register(
    Component
         .For<ISftpRepository,ISftpFileStoreRepository,AbstractSftpFileStoreRepository>()
         .ImplementedBy<ConcreteSftpRepository>()
         .Properties(PropertyFilter.IgnoreAll)
         .DependsOn(
              Dependency.OnConfigValue("host",config.Host),

要么:

.ConfigureFor<QuartzJob>(
      x => 
      x.DependsOn(ServiceOverride.ForKey<IService>().Eq("intraService")))

注意:请注意所有安装类在主应用程序下运行时都能正常工作,这在运行单元测试时纯粹是一种情境.

谢谢你的帮助.

解决方法

看起来你有一个较旧版本的Windsor在部署时会覆盖新版本

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读