WCF errors: No set method for property on Type ‘xx’

By | January 20, 2010

I was surprised when i first saw this error. This usually happens when you try to publish DataContract on WCF service containing Read only properties. I don’t know why exactly this error occurs? As many people are concerned, workaround for this problem looks very obvious.

Add Setter to the property in question.  But, this move will defeat your original purpose of Read only property.

Huh.., Ok, here’s solution. just add Private keyword to your setter method. WCF allows this provision. So, client can never see the set method on your property acting much like a read only property.

Category: WCF