Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

i'm writing a wcf service and try to hold my Uri clean. I want to fire a "GET"-method with different parameters like that:
C#
/// <summary>
/// Gives back a(n) Address by its id
/// </summary>
/// <param name="Address_id">The _id of the Address</param>
/// <returns>A(n) Address</returns>
[OperationContract(Name = "GetAddressById")]
[WebInvoke(Method = "GET", UriTemplate = "/Address/?id={id}")]
Address GetAddressById(int id);

and like that:
C#
/// <summary>
/// Gives back a(n) Address by its City
/// </summary>
/// <param name="Address.City">The City of the Address</param>
/// <returns>A list of Address(e)s</returns>
[OperationContract(Name = "GetAddressByCity")]
[WebInvoke(Method = "GET", UriTemplate = "/Address/?City={city}")]
List<Address> GetAddressByCity(string city);

When i try to start the host, it says that i am not able to do something like that. Is there any possibility to enable such "multi"-uri with different parameters?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900