【问题标题】:Castle Windsor container.Resolve produces null reference exceptionCastle Windsor container.Resolve 产生空引用异常
【发布时间】:2020-11-13 19:16:10
【问题描述】:

在我的 Visual Studio 环境中,我使用 Castle Windsor 依赖注入的项目运行正常。

但是,当部署到目标环境时,它无法启动。捕获异常已显示此问题:

Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
    at My.MyService..ctor()
    at My.Program.Main(System.String[])

我检查了注册,但一切似乎都正常。

有什么想法吗?

【问题讨论】:

    标签: castle-windsor


    【解决方案1】:

    原来我的安装程序未能部署一些 dll。修复后,上述异常就消失了。

    要点:当一个类型无法加载依赖解析时,你会收到一个 NullReferenceExecption。当库不可用时,像框架那样获取 TypeLoadException 会更友好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多