类型的DataContract已经存在且合同不相等

时间:2014-12-12 20:47:51

标签: c# web-services wcf

在IE中浏览我的wcf服务时出现以下错误:

DataContract for type PredefinedNote cannot be added to DataContractSet since type [IEnumerable[PredefinedNote]] with the same data contract name 'serviceResponseBaseGeneric' in namespace 'http://test.service.schema' is already present and the contracts are not equivalent

以下是有问题的服务合同:

[ServiceContract(Namespace = "http://test.service.schema")]
public interface IPredefinedNotesService
{
    [OperationContract]
    IEnumerable<PredefinedNote> GetPredefinedNotes(NoteKindIdentifier noteKind);

    [OperationContract]
    PredefinedNote GetPredefinedNoteById(int id);
}

奇怪的是,我可以成功调用Web服务并获得预期的结果,但在浏览IE中的服务时会出现此错误。

0 个答案:

没有答案