开发者

using class interface as a parameter in wcf service

I Have WCF Service Contract and Using a class interface as a parameter as follow :

[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.Channe开发者_如何学编程ls.ServiceChannel, cannot be used for communication because it is in the Faulted state

Can anyone help me by this problem

Thanks Afshin


I think the concret object you passed in for the IClientID is just unknown to the service. You have to add it with KnownType-Attribute

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜