serviceknowntype

WCF: Is serialization of a generic interfaces possible?

大憨熊 提交于 2019-12-12 08:03:30
问题 I'm trying to implement a service contract that contains a method which takes a generic interface, and that generic interface itself is given an interface parameter. I've decorated the service interface with ServiceKnownType, I have decorated the service implementation with regular KnownType, and I have decorated the datacontract implementation with regular KnownType: [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(ICallbacks))] [ServiceKnownType(typeof(Batch

WCF Client having problems recognizing ServiceKnownTypes?

旧时模样 提交于 2019-11-30 04:02:05
问题 How would I tell the WCF service what KnownTypes to use when passing data back to the client? I know I can use the [ServiceKnownType] attribute, which makes the service call run fine from a WCF Test Server, however it still fails from the client. Am I missing something here? [OperationContract] [ServiceKnownType(typeof(SubClassA))] [ServiceKnownType(typeof(SubClassB))] BaseClassZ GetObject(); Error message from client is: {"Element 'http://schemas.datacontract.org/2004/07/BaseClassZ' contains

WCF: Interfaces, Generics and ServiceKnownType

淺唱寂寞╮ 提交于 2019-11-27 16:33:07
问题 I have the following: [ServiceContract] [ServiceKnownType(typeof(ActionParameters))] [ServiceKnownType(typeof(SportProgram))] [ServiceKnownType(typeof(ActionResult<SportProgram>))] public interface ISportProgramBl { [OperationContract] IActionResult<ISportProgram> Get(IActionParameters parameters); } When I run the Get method I get the following error: There was an error while trying to serialize parameter http://tempuri.org/:GetResult. The InnerException message was 'Type 'PPS.Core