The expected "data contract" is Image , but it received an instance of Bitmap : Image . WCF loves to know about inheritance in advance, so you will need to talk about it. But! I honestly don't think this is a good approach; you should just simply throw away the raw binary, which probably means first storing the Image in a MemoryStream . You should also formally decorate your type of contract. I would send:
[DataContract] public class MyImage { [DataMember] public byte[] Image { get; set; } [DataMember] public string FullPath { get; set; } }
An example of getting byte[] :
using(var ms = new MemoryStream()) { image.Save(ms, ImageFormat.Bmp); return ms.ToArray(); }
source share