これは私のクライアントクラスです
using System;
using System.Data;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace Main.Communication
{
public delegate void EventReceivedEventHandler(DataSet InBoxNotifications, bool updateOutBoxFlag);
public delegate void OpenConnectEventHandler(int spaceId, string accessionNumber, string modality, long assignedCaseId, long originalCaseId);
[DataContract]
public class ClientClass : IClient, IDisposable
{
public event EventReceivedEventHandler EventReceived;
public event OpenConnectEventHandler OpenConnectSystem;
public ClientClass(int userId)
{
this.UserId = userId;
this.Authentication = Guid.NewGuid().ToString();
}
private string _authentication;
[DataMember]
public string Authentication
{
get { return _authentication; }
set { _authentication = value; }
}
private int _userId;
[DataMember]
public int UserId
{
set { _userId = value; }
get { return _userId; }
}
#region "IClient Members"
public bool UpdateInDataBox(DataSet InBoxNotifications, bool updateOutBoxFlag)
{
if (EventReceived != null) EventReceived(InBoxNotifications, updateOutBoxFlag);
return true;
}
public void OpenReviewPanel(int spaceId, string accessionNumber, string modality, long assignedCaseId, long originalCaseId)
{
if (OpenConnectSystem != null) OpenConnectSystem(spaceId, accessionNumber, modality, assignedCaseId, originalCaseId);
}
#endregion
#region IDisposable Members
public void Dispose()
{
((ICommunicationObject)this).Abort();
}
#endregion
}
}
はどこIClient
ですかCallback
。netTcp
バインディングを使用しています。このオブジェクトをサーバー メソッドに渡すと、次のようなエラーが発生します。
パラメータhttp://tempuri.org/:observerをシリアル化しようとしてエラーが発生しました。InnerException メッセージは、「タイプ 'Main.Communication.ClientClass' データ コントラクト名 'CommunicationClient:http://schemas.datacontract.org/2004/07/Main.Communication.ClientClass' は想定されていません」でした。たとえば、KnownTypeAttribute 属性を使用するか、DataContractSerializer に渡される既知の型のリストにそれらを追加することにより、静的に認識されていない型を既知の型のリストに追加します。詳細については、InnerException を参照してください。