Content Type application/soap+xml; charset=utf-8 was not supported by service

后端 未结 17 2347
长发绾君心
长发绾君心 2020-12-15 02:54

I am getting the error below while trying to add WCF service to WCFTestClient. I went through a number of solutions on the web but I couldn\'t get it to work.

Can

17条回答
  •  再見小時候
    2020-12-15 03:19

    I experienced the same error message. I managed to fix it:

    In my case the error was that I missed the [datacontract] and [datamember] attributes in the parent class of my returned class. The error message was misleading.

    [OperationContract]
    List GetData();
    
    [DataContract]
    public class MyClass : MyParentClass
    {       
        [DataMember]
        public string SomeString { get; set; }      
    }
    
    // Missing DataContract
    public class MyParentClass
    {
        // Missing DataMember
        public int SomeNumber { get; set; }
    
    }
    

提交回复
热议问题