NetTcpBinding TransferMode.Streamedを使用するWCFサービスがあり、そのコールバックを使用してクライアントにストリームバックしようとしていますが、次の行でこの例外が発生しますhost.Open
。
Contract requires Duplex, but Binding 'NetTcpBinding' doesn't support it or isn't configured properly to support it.
ServiceHost host;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Uri baseAddress = new Uri(string.Format("net.tcp://{0}:1991/service", Dns.GetHostName()));
host = new ServiceHost(typeof(WCF_Server.MainService), baseAddress);
host.Open();
}
サービスインターフェース:
[ServiceContract(CallbackContract = typeof(IScreenCallback))]
public interface IScreenShot
{
[OperationContract]
Stream GetStream(int formatIndex);
[OperationContract]
void ShowGallery();
[OperationContract]
void CloseGallery();
[OperationContract]
void AddImage(Stream stream);
}
public interface IScreenCallback
{
[OperationContract]
void NextImage();
[OperationContract]
void PrevImage();
[OperationContract]
void AddImageClient(Stream stream);
}
ストリームをクライアントコールバックに渡すにはどうすればよいですか?