UriTemplate参数和方法参数之间的差异

时间:2014-06-05 07:24:16

标签: c# wcf c#-4.0 uritemplate

考虑代码

[WebInvoke(UriTemplate="/{memId}/{username}")]
[ServiceContract]
void Method(string strMemId,string strUname)
{
// my code goes here
}

UriTemplate中是否存在参数,与方法参数相同? 如果没有,他们何时需要/需要?

感谢。 任何投入都赞赏。

1 个答案:

答案 0 :(得分:0)

如果方法参数通过Uri传递,传输顺序,则必须设置Uritemplate。你的情况是(UriTemplate = "/ {strMemId} / {strUname}" ) 如果不这样做,程序将无法理解在哪里找到所需的参数

相关问题