Hi i have an service looks something like this.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
public class Service : IService
{
public string test(string value)
{
IServiceCallBack callback = OperationContext.Current.GetCallbackChannel<IServiceCallBack>();
callback.callBackTest("callBack response");
return value + ", normal response";
}
}
[ServiceContract(CallbackContract = typeof(IServiceCallBack))]
public interface IService
{
[OperationContract]
[WebInvoke(
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
Method = "POST")]
string test(string value);
}
public interface IServiceCallBack
{
[OperationContract]
void callBackTest(string value);
}
Now my needs are that two different bindings will use this same service (if possible) i know i can make two entire seperate services for this to work, but i rather not because the two bindings will use the same functions
My scenario is that we have some clients which is apple devices that will use an WebHttpBinding
And windows clients that will use NetTcpBinding
Now i want the windows clients to be able to use the callback, but with the apple devices i just want to ignore the callback.
if i try to host the service with the WebHttpBinding
i get this error
base = {"Contract requires Duplex,
but Binding 'WebHttpBinding' doesn't
support it or isn't configured properly to support it."}
To me this means that it wont work but can possibly be configured to work? or do they mean that i have to configure and remove my callback for this to work?
So is it possible to ignore the callback for the WebHttpBinding
and just receive the normal responses?