views:

223

answers:

1

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.

+3  A: 

I think your missing the actual service name.

http://localhost:3305/yourservicename.svc/rest/Hello

mdm20
Yup - don't forget the SVC-file in your URL !
marc_s
That worked. I also had to change the ending binding to be "webHttpBinding" and create an endpoint behavior that specified <webHttp /> -- probably obvious misses to people familiar with this stuff, but not easily discoverable for people new to WCF. Thanks again.
jerhinesmith