我有WCF服务合同并使用类接口作为参数如下:
[ServiceContract(Name = "IFrameworkBaseService", CallbackContract = typeof(IFrameworkBaseServiceCallback))]
public interface IFrameworkBaseService
{
[OperationContract]
void InitializeConnection(IClientID clientID);
}
但是我收到以下错误:
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state
任何人都可以帮我解决这个问题
由于 阿夫欣
答案 0 :(得分:1)
我认为您为客户端ID传递的具体对象对服务来说是未知的。 您必须使用KnownType - 属性
添加它[ServiceContract(Name = "IFrameworkBaseService", CallbackContract = typeof(IFrameworkBaseServiceCallback))]
[KnownType(typeof(MyClientId))]
public interface IFrameworkBaseService
{
[OperationContract]
void InitializeConnection(IClientID clientID);
}