“/literal/{param}/literal”是 WCF restful 服务的有效 url 模板吗
Is "/literal/{param}/literal" a valid url template for a WCF restful service
我正在尝试使用以下 URL 模板向基于 WCF 的 REST 服务添加新端点:
/books/{bookId}/pdf
但它给出了一个错误提示:
The UriTemplate '/books/*/pdf
' is not valid; the wildcard ('*') cannot appear in a variable name or literal, unless as a construct for a wildcard segment. Note that a wildcard segment, either a literal or a variable, is valid only as the last path segment in the template; the wildcard can appear only once. See the documentation for UriTemplate for more details.'
这是服务合同:
[OperationContract]
[WebInvoke(UriTemplate = "/books/{bookId}/pdf", Method = "POST")]
Message GetBookPDF(string bookId);
这是变量仅作为 url 的最后一部分有效的限制吗?我找不到任何 link 来证实这一点。
我正在尝试使用以下 URL 模板向基于 WCF 的 REST 服务添加新端点:
/books/{bookId}/pdf
但它给出了一个错误提示:
The UriTemplate '
/books/*/pdf
' is not valid; the wildcard ('*') cannot appear in a variable name or literal, unless as a construct for a wildcard segment. Note that a wildcard segment, either a literal or a variable, is valid only as the last path segment in the template; the wildcard can appear only once. See the documentation for UriTemplate for more details.'
这是服务合同:
[OperationContract]
[WebInvoke(UriTemplate = "/books/{bookId}/pdf", Method = "POST")]
Message GetBookPDF(string bookId);
这是变量仅作为 url 的最后一部分有效的限制吗?我找不到任何 link 来证实这一点。