Wcf 服务引用正在忽略knowntype

Wcf 服务引用正在忽略knowntype,wcf,.net-4.0,known-types,Wcf,.net 4.0,Known Types,我指定了LeeDictionary,这样我就可以设置自己的名称空间,尽管这可能是名称空间问题,但将其更改为Dictionary也是一样的。当字典本身包含另一个字典并抱怨类型未知时,问题就出现了 如果我将knowntype行添加到reference.cs中,那么一切都可以正常工作,但我不明白为什么在生成引用时它不会将其放入?序列化程序理解列表。不要包括在内。只需执行[KnownTypeOfSiccpd.LeeDictionary]它仍然会忽略KnownTypeOfSiccpd.LeeDiction

我指定了LeeDictionary,这样我就可以设置自己的名称空间,尽管这可能是名称空间问题,但将其更改为Dictionary也是一样的。当字典本身包含另一个字典并抱怨类型未知时,问题就出现了


如果我将knowntype行添加到reference.cs中,那么一切都可以正常工作,但我不明白为什么在生成引用时它不会将其放入?

序列化程序理解列表。不要包括在内。只需执行[KnownTypeOfSiccpd.LeeDictionary]它仍然会忽略KnownTypeOfSiccpd.LeeDictionary]如果我更改为上面的-奇怪的是,从您发布的内容中,我们看不到它会忽略它,可以吗?第二个代码段是简短的,我认为它应该包括Results属性以及reference.cs中的LeeDictionary。我试图重新提出您的问题,但这两个问题是为我正确生成的。如[System.Diagnostics.DebuggerStepThroughAttribute][System.CodeDom.Compiler.GeneratedCodeAttributeSystem.Runtime.Serialization,4.0.0.0][System.Runtime.Serialization.DataContractAttributeName=TestResponse,Namespace=Cicicpd][System.SerializableAttribute]公共部分类TestResponse:object,System.Runtime.Serialization.IEExtensibleDataObject,System.ComponentModel.INotifyPropertyChanged{….应具有[KnownTypeOfList],但在引用中没有任何KnownTypeList的迹象。cs这是引用中的leedictionary.cs:`[System.Diagnostics.DebuggerStepThroughAttribute][System.CodeDom.Compiler.GeneratedCodeAttributeSystem.Runtime.Serialization,4.0.0.0][System.Runtime.Serialization.CollectionDataContractAttributeName=LeeDictionary,Namespace=Test,ItemName=KeyValueOfstringanyType,KeyName=Key,ValueName=Value][System.SerializableAttribute]公共类词典:System.Collections.Generic.Dictionary{}`
[CollectionDataContract(Namespace = "CISICPD")]
[KnownType(typeof(List<CISICPD.LeeDictionary>))]
public class LeeDictionary : Dictionary<string, object> 
{
}

[DataContract(Namespace = "CISICPD")]
[KnownType(typeof(List<CISICPD.LeeDictionary>))]
public class TestResponse
{
    [DataMember]
    public List<LeeDictionary> Results;

    public TestResponse() { Results = new List<LeeDictionary>(); }
    [OnDeserializing]
    private void OnDeserialize(StreamingContext c) { Results = new List<LeeDictionary>(); }
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="TestResponse", Namespace="CISICPD")]
[System.SerializableAttribute()]
public partial class TestResponse : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {