I have trying to design a REST service in .NET 3.5 with WCF REST Contrib. My service is nearly working fine, but I am facing a bizarre error.
Basically, I have two methods:
[WebInvoke(UriTemplate = "/books?id={identity}", Method = "PUT")]
public string InsertBook(string identity, Book book)
{
// snipped
}
and
[WebInvoke(UriTemplate = "/books?id={identity}", Method = "GET")]
public Books[] ListBooks(string identity)
{
// snipped
}
Yet I am getting the error message at activation time:
System.InvalidOperationException was unhandled by user code Message="UriTemplateTable does not support multiple templates that have equivalent path as template '/books?id={identity}' but have different query strings, where the query strings cannot all be disambiguated via literal values. See the documentation for UriTemplateTable for more detail." Source="System.ServiceModel.Web"
If I rename the second method as /books2?identity
then it works fine.
Any idea why the UriTemplateTable
is not distinguishing between verbs?