I’m protyping an application with WCF and I’m trying to define a Callback
Contract with an interface that derives from another one.
Doing so, the generated proxy code (using svcutil.exe) does not see the base
interface and a “NotSupportedException” is thrown on the Server when trying
to call methods defined in base interface.
I have also tried to manually define the base interface in the proxy class
so as to be able to implement the methods in the client -> Same behavior.
Does anyone knows why it does not work?
Thanks for any help and sorry for the repost!
Here is my contract definition :
namespace wcfContract
{
[ServiceContract(Namespace = "Test")]
public interface IPing
{
[OperationContract]
void Ping();
}
public interface ITestCallback : IPing
//<-------------- IPing method not seen at all in proxy
{
[OperationContract]
void TestCB();
}
[ServiceContract(Namespace = "Test", CallbackContract =
typeof(ITestCallback))]
public interface ITest : IPing
{
[OperationContract]
void Test();
}
}
You’ll need to add the [ServiceContract] attribute to the ITestCallback interface.
The service class needs to inherit the derived contract (ie. ITestCallback).
The corresponding endpoint binding in the Web.config file needs to specify the correct contract (as in the endpoint address for “ws” below).
This worked for me; hope it works for you. I didn’t use the svcutil, I just referenced by adding a service reference in a project.