Using a class interface as a parameter in a wcf service

I have a contract for serving WCF and using the class interface as a parameter:

[ServiceContract(Name = "IFrameworkBaseService", CallbackContract = typeof(IFrameworkBaseServiceCallback))]
public interface IFrameworkBaseService
{
    [OperationContract]
    void InitializeConnection(IClientID clientID);
}

but I get the following error:

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state

Can someone help me with this problem

Thanks Afshin

+2
source share
1 answer

I think the specific object that you passed for IClientID is simply unknown to the service. You must add it using KnownType -Attribute

[ServiceContract(Name = "IFrameworkBaseService", CallbackContract = typeof(IFrameworkBaseServiceCallback))]
[KnownType(typeof(MyClientId))]
public interface IFrameworkBaseService
{
    [OperationContract]
    void InitializeConnection(IClientID clientID);
}
+1
source

All Articles