Search code examples
wcf.net-core

.Net Core 3.1, WCF connected services doesn't bind the name property in console app


I added a wcf service in console application and I executed it. Everything is looking good without just one property.

The name property value always is null. When I execute with SoapUI, that has a value.

enter image description here

I was tried with the same parameter values but I didn't receive the name value. The others haven't any problem. Just the name property doesn't bind. Why?

enter image description here

Could you help me, pls? Thanks.


Solution

  • According to your description, if the name received in SoapUI is not null, but the name received by the client is null, there should be some problems with your client.After my test, I found that this error will occur if the property in the client class does not add DataMember.You need to make sure that DataMember exists on your name property.

    enter image description here

    If you are a proxy class generated by a service reference, you need to find the class that contains the name property and check whether the name property has [System.Runtime.Serialization.DataMemberAttribute()].

    enter image description here

    If you are calling the service through the channel factory, make sure that the name property exists [DataMember].