零星的“接口,无法构建”。您是否缺少类型映射”
站点的初始部署工作正常。大约 2-3 小时后,由于无法解决依赖关系,控制器突然无法实例化(或者至少错误消息告诉我的是这样的)。
我尝试了各种方法,但似乎都没有解决问题。有人知道我可以检查什么吗?
Initial deployment of the site works fine. After about 2-3 hours, the controllers suddenly cannot be instantiated due to a dependency cannot be resolved (or at least that's what the error message tells me).
I have tried various things, but none of which seem to resolve it. Does anyone have any ideas what I can check?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最近我们的一款拦截器也遇到了类似的情况。突然间它就不再起作用了。我们拦截对程序集 XYZdll 中定义的接口的所有调用。但操作系统在一段时间后决定调用该文件 XYZDLL。在此期间没有发生新的部署。但突然名字匹配失败了。您是否按名称加载配置中的某些程序集?也许您应该在字符串比较中检查 IgnoreCase。
另一个想法:你是否为你的对象使用某种缓存?或者基于缓存的 LifetimeManager?如果缓存项在一段时间后失效,您将丢失这些对象。
Recently we had a similar situation with one of our Interceptors. All of a sudden it would no longer work. We intercept all calls to interfaces defined in assembly X.Y.Z.dll. But the OS decided to call the file X.Y.Z.DLL after a while. No new deployment happened in the meantime. But all of a sudden the name matching failed. Do you load some assemblies in your configuration by name? Maybe you should check for IgnoreCase in string comparisons.
Another idea: Do you use some kind of cache for your objects? Or a cache based LifetimeManager? If cache items get invalidated after some time you would loose those objects.
我仍然不知道发生了什么,但我设法解决了它。我正在使用第三方引导库来注册我的组件和映射。但在我自己使用 MEF 进行操作并自己控制注册后,问题就消失了。我猜它正在做一些奇怪的事情,在不应该处理的时候处理掉一些东西。感谢您的帮助。
如果有人使用 http://bootstrapper.codeplex.com/ 并使用以下声明遇到此问题:
我替换that with:
where
请注意,IUnityRegistration.Register() 和 IMapCreator.CreateMap() 是在第三方代码中定义的。 MEF 引用 System.ComponentModel.Composition
和 System.ComponentModel.Composition.Hosting。最终会重构。
i still have no idea what was happening, but i managed to fix it. i was using a third-party bootstrapping library to register my components and mappings. but after rolling my own with MEF, and controlling the registrations myself, the issue went away. i'm guessing it was doing something funky by disposing things when it shouldn't have. thanks for the help.
In case someone encounters this problem using http://bootstrapper.codeplex.com/ with the following declaration:
I replaced that with:
where
Note that IUnityRegistration.Register() and IMapCreator.CreateMap() are defined in the third-party code. MEF references System.ComponentModel.Composition
and System.ComponentModel.Composition.Hosting. Will eventually refactor.