NetNamedPipeBinding エンドポイントでリッスンする ServiceHost があります。クライアントによって呼び出され、サーバーによって処理される単一のメソッドを持つサービス コントラクト クラスがあります。メソッド (PipeRequest() と呼びます) には Request パラメータがあります。クライアント側では、このオブジェクトにデータを入力しますが、サーバーに送信されるまでは空です。なぜこれが当てはまるのでしょうか?
_Host = new ServiceHost(typeof(PipeService), new Uri(ServiceRequestRouter.URI));
_Host.AddServiceEndpoint(
typeof(IPipeService),
new NetNamedPipeBinding(),
_PipeName
);
_Host.Open();
[ServiceContract(Namespace = "http://www.example.com/PipeCommunication")]
interface IPipeService
{
[OperationContract]
void PipeRequest(ServiceRequestBase request);
}
[DataContract]
[KnownType(typeof(DerivedServiceRequest))]
[KnownType(typeof(SomeEnumType))]
public abstract class ServiceRequestBase
{
...
public void Dispatch(string pPipeName = ServiceRequestRouter.DefaultPipeName)
{
EndpointAddress epa = new EndpointAddress(_address_));
IPipeService proxy = ChannelFactory<IPipeService>.CreateChannel(new NetNamedPipeBinding(), epa);
proxy.PipeRequest(this);
}
}