从 AppFabric 缓存检索时加载程序集时出错
今天我在调试一个项目时遇到了一个奇怪的问题。我使用 VS2010 / windows 7 home premium。
我有一个使用 Windows Server AppFabric 缓存的项目。我已经配置了所有内容,并创建了两个不同的 C# 项目(2 个解决方案)来测试 AppFabric 配置。项目名称为“AppFabricServer”和“AppFabricClient”。这仅用于测试,命名约定并不意味着任何特定的内容。我使用“AppFabricServer”将对象添加到 AppFabric 缓存和“AppFabricClient”项目以进行检索。
现在,问题是在运行“AppFabricServer”之后,然后我在关闭“AppFabricServer”后尝试运行“AppFabricClient”,出现错误“System.IO.FileNotFoundException:无法加载文件或程序集'AppFabricServer< /强>”。我不明白“AppFabricServer”项目与“AppFabricClient”项目以何种方式相关。
反之亦然,这意味着,重新启动计算机后,如果我先运行“AppFabricClient”项目(它也有一个缓存写入模块),我将无法运行“AppFabricServer”项目(它有一个缓存)阅读模块也是如此)。我收到相同的错误 -“System.IO.FileNotFoundException:无法加载文件或程序集“AppFabricClient”。
当我调用 DataCache 的 Get 方法时,在尝试从缓存检索数据的行引发异常。
有人可以帮忙吗?
I ran into a weird issue today while debugging one of my projects. I use VS2010 / windows 7 home premium.
I have a project that uses Windows Server AppFabric Cache. I have configured everything, and have created two different C# projects (2 solutions) to test the AppFabric configuration. The project names are "AppFabricServer" and "AppFabricClient". This is just for testing and the naming convention doesn't mean anything specific. I use "AppFabricServer" to Add objects to AppFabric Cache and "AppFabricClient" project to retrieve.
Now, the problem is after running the "AppFabricServer" and then I try to run "AppFabricClient" after closing the "AppFabricServer", I get an error "System.IO.FileNotFoundException: Could not load file or assembly 'AppFabricServer". I don't understand in which way "AppFabricServer" project is related to "AppFabricClient" project.
The same thing happens vice-verse also - this means, after restarting the computer and if I run "AppFabricClient" project first (it also has a Cache writing module), I am not able to run "AppFabricServer" project (it has a Cache reading module as well). I get the same error -"System.IO.FileNotFoundException: Could not load file or assembly 'AppFabricClient".
The exception is thrown at the line where I try to retrieve data from the Cache - when I call the Get method of DataCache.
Can someone please help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AppFabric 利用 NetDataContractSerializer 来序列化对象。该序列化器对 CLR 类型信息进行编码。因此,即使对象的形状相同,实际上也要求它们在同一组件中具有相同的类型。
因此,从 AppFabricServer 程序集中取出要序列化的对象,并将其放入 AppFabricServer 和 AppFabricClient 程序引用的第三个程序集中。这样,两者的 CLR 类型信息将相同。
AppFabric utilizes the NetDataContractSerializer to serialize objects. This serializer encodes CLR type information. So, even if the shape of your objects is the same, it actually requires them to be the same types in the same assembly.
Therefore, take the object you are serializing out of the AppFabricServer assembly and put it in a third assembly that is referenced from both the AppFabricServer and AppFabricClient programs. That way, the CLR type information will be the same in both.