WCF问题:这是我自己的错误吗?

WCF问题:这是我自己的错误吗?,wcf,dictionary,Wcf,Dictionary,我定义了以下方法: [OperationContract] [FaultContract(typeof(UserFriendlyError))] bool MakeOutInvoice(Dictionary<string, string> pk, string usergid); [运营合同] [FaultContract(typeof(UserFriendlyError))] bool makeoutingvoice(字典主键,字符串usergid);

我定义了以下方法:

    [OperationContract]
    [FaultContract(typeof(UserFriendlyError))]
    bool MakeOutInvoice(Dictionary<string, string> pk, string usergid);
[运营合同]
[FaultContract(typeof(UserFriendlyError))]
bool makeoutingvoice(字典主键,字符串usergid);
在我的网站中,我添加了服务参考,vs 2010生成以下代码:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays")]
public partial class ArrayOfKeyValueOfstringstringKeyValueOfstringstring : object, System.ComponentModel.INotifyPropertyChanged {

    private string keyField;

    private string valueField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=0)]
    public string Key {
        get {
            return this.keyField;
        }
        set {
            this.keyField = value;
            this.RaisePropertyChanged("Key");
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
    public string Value {
        get {
            return this.valueField;
        }
        set {
            this.valueField = value;
            this.RaisePropertyChanged("Value");
        }
    }

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName) {
        System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if ((propertyChanged != null)) {
            propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
    }
}

   public bool MakeOutInvoice(ArrayOfKeyValueOfstringstringKeyValueOfstringstring[] pk, string usergid) {
        LPM.Web.LPTMSFinancialServiceRef.MakeOutInvoiceRequest inValue = new LPM.Web.LPTMSFinancialServiceRef.MakeOutInvoiceRequest();
        inValue.pk = pk;
        inValue.usergid = usergid;
        LPM.Web.LPTMSFinancialServiceRef.MakeOutInvoiceResponse retVal = ((LPM.Web.LPTMSFinancialServiceRef.ILPTMSFinancialService)(this)).MakeOutInvoice(inValue);
        return retVal.MakeOutInvoiceResult;
    }
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Xml”,“4.0.30319.17929”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true,命名空间=”http://schemas.microsoft.com/2003/10/Serialization/Arrays")]
公共部分类ArrayOfKeyValueOfStringStringStringKeyValueOfStringString:对象,System.ComponentModel.INotifyPropertyChanged{
私有字符串键域;
私有字符串值字段;
/// 
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true,Order=0)]
公共字符串密钥{
得到{
返回这个.keyField;
}
设置{
this.keyField=值;
此。RaisePropertyChanged(“密钥”);
}
}
/// 
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true,Order=1)]
公共字符串值{
得到{
返回此.valueField;
}
设置{
this.valueField=值;
本.增加财产变动(“价值”);
}
}
公共事件System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
受保护的void RaisePropertyChanged(字符串propertyName){
System.ComponentModel.PropertyChangedEventHandler propertyChanged=this.propertyChanged;
如果((propertyChanged!=null)){
propertyChanged(这是新的System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
public bool MakeoutionVoice(ArrayOfKeyValueOfStringStringStringKeyValueOfStringString[]主键,字符串usergid){
LPM.Web.lptmsfinancialservicef.makeoutingvoicerequest invaliue=新的LPM.Web.lptmsfinancialservicef.makeoutingvoicerequest();
inValue.pk=pk;
inValue.usergid=usergid;
LPM.Web.lptmsfinancialservicef.makeoutingvoiceresponse retVal=((LPM.Web.lptmsfinancialservicef.ILPTMSFinancialService)(此)).makeoutingvoice(无效);
返回retVal.makeOutingVoiceResult;
}
在我看来,它应该生成与WCF相同的参数。 为什么它用字典代替生成新类型参数?
谢谢你的帮助

您的MakeoutionVoice方法是wcf合同的一部分吗?是的,它是为客户机调用的方法。wcf旨在成为SOA
Dictionary
是一个.NET对象(是的,我知道其他语言也有Dictionary对象),因此为了最大限度地提高互操作性,它将字典转换为您在自动生成的代理中看到的定义。您可以尝试的另一个选项是,在添加服务时,单击“高级”按钮,然后在“数据类型”下,您可以告诉它如何处理字典集合类型。我不使用服务引用来访问WCF服务,所以这只是一个有点常识的猜测。谢谢Tim!我添加了带有“高级”选项的服务引用,但没有任何更改。为了解决这个问题,我必须将字典序列化为Json字符串作为参数,并将其反序列化为客户端和服务器之间的字典。再次感谢您的帮助。