Pregunta

I've this WCf Interface definition

public interface IDataToMfcV2
{       
    [OperationContract(IsOneWay = false)]
    SecurityAnswerDTO CommitDTOs(string sessionId, BasicDTO[] basicDto);        
}

and now I have different Objects which derive from BasicDTO! Now I want to know, is it Possible to send a List of derived Objects to this call?

Because I got this exception:

The message with Action 'X' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

¿Fue útil?

Solución 2

Was my fault! I connected to a completly wrong URI!

Otros consejos

You need to add ServiceKnownType attribute to the service interface for all derived classes which you are planning to send and receive using the service.

e.g.

public class X : BasicDTO
public class Y : BasicDTO

[ServiceContract]
[ServiceKnownType(typeof(X))]
[ServiceKnownType(typeof(Y))]
public interface IDataToMfcV2
{       
    [OperationContract(IsOneWay = false)]
    SecurityAnswerDTO CommitDTOs(string sessionId, BasicDTO[] basicDto);        
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top