I have an MVC project in .Net 4 with WCF service with BasicHttpBinding.
When consuming this service in .Net 2 the values that arriving if the property is int are 0.
if it is a string, than it goes fine.
bulding a new project in .Net 4 consuming the same service and using the exact implementation (as the .Net 2) ==> the int values are correct.
WHY?
Thanks!
I bet you have a data contract that has the actual
intproperty:as well as a
YourPropertySpecifiedproperty along side it:Since an
intcannot be null, WCF cannot distinguish whether or not you have defined a value – you need to tell it.So if you use an
intproperty and set a value to it – you also need to set its accompanyingYourPropertySpecifiedproperty to true:With this extra step, the
intvalues should arrive at the server just fine