I get the following exception (Cannot have two operations in the same contract with the same name, methods ExecuteAsync and Execute) when the following service is activated.
Here's what I did. I have two separate contracts. One for the client and one for the server:
namespace ServiceLibrary.Server
{
[ServiceContract]
public interface IMyService
{
[OperationContract]
byte[] Execute(MyRequest request);
}
}
namespace ServiceLibrary.Client
{
[ServiceContract]
public interface IMyService : Server.IMyService
{
[OperationContract]
Task ExecuteAsync(MyRequest request);
}
}
Because both ServiceContracts share the same name, the OperationContracts' Action and ReplyAction are the same for the async and sync methods. The client now has both the sync and async version and the server stays unmodified.