I have a WCF service, using NetTcpBinding TransferMode.Streamed, I'm looking to stream back to client using its callback, but i get this exception on the line 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();
}
service interface :
[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);
}
how would i pass stream to client callback?