Hi, I have application created using WCF and C#, it's architecture requires to add KnownTypes through App.config. I have services going like this: Client -> CentralServer -> DataServer (where -> is WCF connection) Now, I've added KnownTypes to both CentralServer App.config and DataServer App.config this way:
<add
type="Odra.Server.CentralServer.SBQL.AbstractSyntax.Declarations.Declaration,
Odra.Server.CentralServer.SBQL">
<knownType
type="Odra.Server.CentralServer.SBQL.AbstractSyntax.Declarations.MethodDeclaration,
Odra.Server.CentralServer.SBQL" />
</add>
My problem is that, calling method whitch takes argument of type MethodDeclaration on DataServer from CentralServer throws an exception that service cannot deserialize this parameter, although CentralServer CAN serialize it (I know, because when I remove KnownType i get exception that service cannot SERIALIZE). In addition, I have plenty of such methods defined same way, but accepting different type as an argument, and they work perfectly. Do you have any idea why this is (not) working like this?
Exception:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:val.
The InnerException message was 'Element 'http://tempuri.org/:val' contains data of the 'http://schemas.datacontract.org/2004/07/Odra.Server.CentralServer.SBQL.AbstractSyntax.Declarations:MethodDeclaration' data contract. The deserializer has no knowledge of any type that maps to this contract.
Add the type corresponding to 'MethodDeclaration' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.