I\'ve got a simple WCF service that has worked fine while I\'ve been testing on my dev machine.
Now I\'ve moved the web service to a web server, and I\'m running the
Late answer to the party, but I got the same error.
Turns out, you cannot use abstract classes for data contract members. I had to use the following:
[DataContract]
public class MyClass {
[DataMember]
public A MyProperty { get; set; }
}
[DataContract]
[KnownType(typeof(B))]
[KnownType(typeof(C))]
public class A {
}
[DataContract]
public class B : A {
}
[DataContract]
public class C : A {
}
In order to allow WCF to serialize something like
var myClass = new MyClass();
myClass.MyProperty = new B();