简体   繁体   中英

Difference between UriTemplate parameters and method parameters

Consider the code

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

Are the parameters present in the UriTemplate,the same to the method parameters? If not, when will they be needed/required?

Thanks. Any inputs appreciated.

If the method parameters are passed through the Uri, the order of transfer, you must set Uritemplate. your situation is would be (UriTemplate = "/ {strMemId} / {strUname}" ) If you do not, the program will not understand where to find the desired parameter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM