Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF
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:
/// <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:
/// <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 3-Jan-13 4:14am

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



Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100