开发者

on wcf type is not expected even though its on ServiceKnownType(typeof(...))

开发者 https://www.devze.com 2023-01-01 22:07 出处:网络
i am using third party classes in my service, so i cant edit them. third party [Serializable] Class B : E

i am using third party classes in my service, so i cant edit them.

third party

[Serializable]  
Class B : E  

[Serialazable]  
Class E : A  

service

[ServiceKnownType(typeof(B))]  
[ServiceKnownType(typeof(E))]  
fun(A pic)  

client

for some reason :

prox开发者_JS百科y.fun(object)  

throw an exception that B is unexpected and add it to the datacontractSerializer KnownTypes

what reason can it be ?.


Are you applying the ServiceKnownType attribute on the service contract or the service implementation? The ServiceKnownType attribute is meant to be to be used on your contract interface.

http://msdn.microsoft.com/en-us/library/system.servicemodel.serviceknowntypeattribute.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号