Castle 不断给我一个 System.TypeLoadException: Method 'myMethod'没有实施吗?
System.TypeInitializationException:
The type initializer for 'XXX' threw an exception.
System.TypeLoadException:
Method 'GetDocuments' in type 'YYY' from assembly 'ZZZ,
Version=1.0.0.0, Culture=neutral PublicKeyToken=null'
does not have an implementation..
尝试使用温莎城堡解析对象时出现上述错误。经过一番谷歌搜索后,似乎其他人由于程序集版本不匹配而遇到了这个问题。我不认为这可能是我的问题,因为包含“myMethod”的程序集在一个项目中被引用。我创建了另一个尝试解析该对象的测试项目。
有人能告诉我我在这里缺少什么吗?
这是失败的组件注册:
private static void Register_IContentDirectory()
{
_container.Register(
Component.For<IContentDirectory>()
.ImplementedBy<DocumentumContentDirectory>()
.ServiceOverrides(
ServiceOverride.ForKey("documentManagementServiceProvider").Eq(
"document.management.service.provider")
));
}
更新:
我已投票结束此问题。我的问题是对另一个程序集的依赖。与城堡无关。
System.TypeInitializationException:
The type initializer for 'XXX' threw an exception.
System.TypeLoadException:
Method 'GetDocuments' in type 'YYY' from assembly 'ZZZ,
Version=1.0.0.0, Culture=neutral PublicKeyToken=null'
does not have an implementation..
I am getting the above error when trying to resolve an object with Castle Windsor. After some Googling it seems that others have had this problem due to assembly version mismatches. I don't believe this can be my problem since the assembly containing 'myMethod' is referenced in one project. I have create another test project that attempts to resolve the object.
Can someone tell me what I'm missing here?
This is the component registration that fails:
private static void Register_IContentDirectory()
{
_container.Register(
Component.For<IContentDirectory>()
.ImplementedBy<DocumentumContentDirectory>()
.ServiceOverrides(
ServiceOverride.ForKey("documentManagementServiceProvider").Eq(
"document.management.service.provider")
));
}
UPDATE:
I have voted to close this Q. My problem is a dependency on another assembly. Not related to castle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如@Nick提到的:
As mentioned by @Nick: