【问题标题】:WCF Comunication Exception when passing string array传递字符串数组时出现WCF通信异常
【发布时间】:2013-11-20 17:31:22
【问题描述】:

我有一个 wcf 服务,我想通过它传递一个 string[]。我收到以下错误。有人能指出我正确的方向吗?

错误:

尝试序列化参数http://services.csssoftware.com/2.0/ComFacades:arParams 时出错。 InnerException 消息是 'Type 'System.String[]' 与数据协定名称 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' 不是预期的。考虑使用 DataContractResolver 或将任何静态未知的类型添加到已知类型列表中 - 例如,通过使用 KnownTypeAttribute 属性或将它们添加到传递给 DataContractSerializer 的已知类型列表中。有关详细信息,请参阅 InnerException。

如果您需要更多数据,请告诉我,我会编辑问题。

【问题讨论】:

标签: string wcf wcf-binding


【解决方案1】:

对于遇到相同错误的其他人,解决方法是在我的接口类中添加:[ServiceKnownType(typeof(string[]))]

有关此问题的更多信息,您可以阅读:HERE

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-17
    • 1970-01-01
    • 2013-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多