0
这里是我的WCF双工服务的回调接口:双工服务引用转换接口类型为System.Object的类型
public interface ICallback
{
[OperationContract(IsOneWay = true)]
void SendClientCallback(CallbackMessage callbackMessage);
[OperationContract]
void GetTemplateList(ref List<ISpecimenTemplateDescriptor> templateDescriptors, IDrawerLayout drawerLayout);
}
我配置我的服务参考使用System.Collections.Generic.List类型。我通过右键单击服务引用,选择配置服务选项并更改集合类型来完成此操作。这将服务引用配置为使用List的集合类型,而不是默认的Array类型。
当我编译和更新我的服务参考,我的接口类型“ISpecimenTemplateDescriptor”和“IDrawerLayout”被转换成“System.Object的”,如下所示:
void GetTemplateList(ref System.Collections.Generic.List<object> templateDescriptors, object drawerLayout);
为什么我的接口对象转换为系统.Object在服务引用中?
这里是我的服务合同:
[ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(ICallback))]
public interface IWcfService
{
.....
}
这里是我的服务行为:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Reentrant, UseSynchronizationContext = false)]
public class WcfService : IWcfService
{
......
}
感谢您的帮助提前!