我已经构建了一个WCF服务库,我添加了几个第三方DLL的引用。这是我的接口运行WCF服务库时出错
[ServiceContract]
public interface IService1
{
[OperationContract]
3rdpartyreturntype GetObj(System.Windows.Controls.Control txtcontrol);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations
[DataContract]
public class nclass
{
[DataMember]
public System.Windows.Controls.Control txtcontrol
{
get { return txtcontrol; }
set { txtcontrol = value; }
}
[DataMember]
public 3rdpartyreturntype nobj
{
get { return vuiobj; }
set { vuiobj = value; }
}
[DataMember]
public System.Windows.Input.TouchDevice tchdev
{
get { return tchdev; }
set { tchdev = value; }
}
}
我已经实现了上面的接口。当我运行服务时出现以下错误,任何人都可以帮我解决问题吗?
类型'System.Windows.Input.TouchDevice'不能被序列化。考虑 使用DataContractAttribute属性标记它,并用DataMemberAttribute属性标记要序列化其成员的所有 。
你能为所有3rdpartyreturntype编写包装吗?如果是这样,那么可以用'[DataMember]'属性标记。 –