I am using the HttpClient library to create a WCF Web API.
Snippet from service contract:
[ServiceContract]
public interface IMyService
{
[WebGet(UriTemplate = "Foo/{id}/{securityKey}/{filename}")]
HttpResponseMessage Foo(int id, string securityKey);
}
When I hit the .svc in a browser I am getting this:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/:IMyService ----> System.Runtime.Serialization.InvalidDataContractException: Type 'System.Net.Http.HttpMethod' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
Does this make sense to anyone? The same code worked in a different project, all the libraries are the same in this case, there must be some nuance I am missing.