我期待一個COM對象傳遞到我的WCF的服務器,但是不管我怎麼努力我不斷收到以下錯誤:第三方COM對象不能被序列化。即使包裝成一個數據成員
Type 'System.__ComObject' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.
我已經試過ServiceKnownType
[ServiceKnownType(typeof(ComClass))]
我曾嘗試它包裹
[DataContract]
public class receivedClass
{
[DataMember]
public ComClass controlClass { get; set; }
}
是否有可能使該序列可以被髮送到我的WCF? (我用這一個IPC程序)
哦,這是COM類是第三方產生
@AnonymousDownvoter請讓我知道我可以在這個問題上改進什麼 – 2012-04-26 20:59:14
沒有。考慮將COM對象的狀態提取到一個紀念對象中併發送它。 – Cheeso 2012-04-26 21:05:04