Question

I am trying to write a host/client style system with WCF and I currently want to use the wsHttpBinding but I was reading up about something else (the isOneWay bool) when I cam across this line:

'HTTP can't be used for callbacks and therefore you can't use callbacks over BasicHttpBinding or WSHttpBinding'

Most of my methods will return values, for example the client would call a method which would send back specific data from the server depending on the method called. Like this, with a return line in:

public string SayHello(string name)
{
    Console.WriteLine(">>> SayHello has been called");
    return string.Format("Hello, {0}!", name);
}

Would the return line make it a callback so would I have to use a different binding? Or is a callback only when the client sends a 'message' to the server and the server sends a 'message' back? In my code it is just calling the method which returns data so would that not be classed as a callback and I can continue to use the wsHttpBinding? Thanks

Was it helpful?

Solution

You definitely don't need wsDualHttpBinding to return values. BasicHttpBinding or even better WSHttpBinding is what you need

wsDualHttpBinding is used to actually call the client from the server (callbacks). It's something which isn't widely used in the web world because it has limitations and there are better options like WebSockets and SignalR

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top