As per the following article, I have defined my service contract as
[ServiceContract]
public interface IServiceContract
{
[OperationContract]
Task<string> HelloAsync(string name);
}
However, when I try to generate a proxy, I get the message Type 'System.Threading.Tasks.Task`1[System.String]' cannot be serialized.
Am I missing something here?
Here is a good answer: http://mylifeandcode.blogspot.com/2012/12/the-cause-and-solution-for.html
Seems need to re-generate proxy classes - instead of "Generate task-based operations" need to choose "Generate asynchronous operations".
The support for Task-based asynchronous operations is only available in the version 4.5 of the .NET Framework Unless you're using the developer preview which was made available in mid-September, this won't work.