I created just the most basic WCF Service Application to do some prototyping, but I can't get the WebGet implementation to work.
Here's my interface:
[ServiceContract]
public interface IService
{
[OperationContract]
[WebGet(UriTemplate = "/rest/{value}")]
string Test(string value);
}
Here's the implementation:
public string Test(string value)
{
return string.Format("You entered: {0}", value);
}
But if I go to http://localhost:3305/rest/Hello in my browser, I get a 404. I'm using the VS 2008 webserver.
I think your missing the actual service name.
http://localhost:3305/yourservicename.svc/rest/Hello
Update
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
//config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}