简体   繁体   English

具有共享类的WCF错误服务错误消息

[英]WCF error service error message with shared classes

Source code: http://code.google.com/p/sevenupdate/source/browse/#hg/Source/SevenUpdate.Base 源代码: http : //code.google.com/p/sevenupdate/source/browse/#hg/Source/SevenUpdate.Base

SevenUpdate.Base.Sui cannot be used since it does not match imported DataContract. 无法使用SevenUpdate.Base.Sui,因为它与导入的DataContract不匹配。 Need to exclude this type from referenced types. 需要从引用的类型中排除此类型。

Now I tried unchecking reuse reference types and I was able to get my project to compile. 现在,我尝试取消选中重用引用类型,从而能够编译我的项目。 but when sending a collection from the client it was never received or couldn't be deserialized on the server end. 但是从客户端发送集合时,服务器端从未收到过该集合,也无法将其反序列化。

I really need this to work. 我真的需要这个工作。 Any help would be appreciated, the fullsource code is provided by google code. 任何帮助将不胜感激,完整的源代码是由谷歌代码提供。

I didnt download the source and build it, but could it be that you are missing DataContract on this class? 我没有下载源代码并进行构建,但是可能是您缺少此类的DataContract吗? Sui class has a property of type Sua as DataMember so it will need to be serialized as well. Sui类具有Sua类型的属性为DataMember,因此也需要对其进行序列化。 It looks like this in your code currently 当前在您的代码中看起来像这样

[ProtoContract, ]
[KnownType(typeof(ObservableCollection<LocaleString>))]
public class Sua

What would I need to do to reproduce this error? 我需要怎么做才能重现此错误? The first bit (about matching data-contract) sounds like WCF isn't very happy with you, which suggests you have two similar (but different) contracts "in play". 第一点(关于匹配数据合同)听起来像WCF对您不太满意,这表明您“正在使用”两个相似(但不同)的合同。 If you are re-using the types from a shared library this shouldn't be a problem. 如果您要重新使用共享库中的类型,则应该没有问题。

If you do end up excluding the types (and having a different model at the client and server) then it can get a bit tricker, since "mex" doesn't guarantee the positions will remain intact (and indde, they regularly change) - but you can fix this in a partial class, by using a few [ProtoPartialMember(...)] against the type (not pretty but it works). 如果最终排除类型(以及具有客户端和服务器不同的型号),然后它可以得到一点小技巧,因为“MEX”不保证该职位将保持不变(和indde,他们经常改变) -但是您可以通过对类型使用一些[ProtoPartialMember(...)] (不是很漂亮,但是可以使用)来解决此问题。

But I stress - the main problem here seems to be WCF; 但我要强调-这里的主要问题似乎是WCF。 if that isn't happy such that the code doesn't codegen / compile etc, then my hands are fairly tied (since it won't get as far as talking to protobuf-net). 如果不满意,导致代码无法进行代码生成/编译等操作,那么我的双手将被束缚住(因为与protobuf-net交谈的距离不远)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM