【发布时间】:2015-04-25 00:11:43
【问题描述】:
我正在开发 WCF REST 服务。我有合同:
[ServiceContract]
public interface IContract
{
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "/somemethod/{param1}")]
SomeResult SomeMethod(int param1) { ... }
/*
More methods...
*/
}
有没有办法为给定合约的所有方法配置一个公共 url 前缀。可能类似于 Web API [RoutePrefix("...")] 属性?
【问题讨论】:
-
Common Url 前缀是什么意思?
-
@Tommassiov 例如,我希望我的所有网址都从“/users/”开始。
标签: c# .net wcf asp.net-web-api wcf-rest