New to configuring anything server side ... thanks in advance for your help!
I am trying to get a simple HelloWorld REST api working in VisualStudio2008 / .NET 3.5; eventually I'll be using it to CRUD test data/results back to the server from a variety of mobile devices running on a local wireless lan.
I've found a number of other questions who's answers change related parts of my app.config, but none seem to apply to this specific issue (and trial and error hasn't yielded any results)
Here is my ServiceContract:
[ServiceContract]
public interface IRestService
{
[OperationContract]
[WebInvoke(
Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "xml/{id}")]
string XMLData(string id); //Implemented as 'return "you requested " + id;'
[OperationContract]
[WebGet]
string Test(); //Implemented as 'return "foobar";'
[OperationContract]
[WebGet]
string Test2(string foo); //Implemented as 'return "foobar=" + foo;'
}
And here is my app.config
<services>
<service name="MyRestService.IRestServiceImpl" behaviorConfiguration="MyServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost/foo/bar"/>
</baseAddresses>
</host>
<endpoint address ="" binding="webHttpBinding" contract="MyRestService.IRestService" behaviorConfiguration="myRestBehavior" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="myRestBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
I'm running via f5 in visualstudio (which I think means I don't have any .svc/IIS stuff to worry about?), and attempting to connect via
http://localhost/foo/bar/Test
http://localhost/foo/bar/Test2 ( /ParamIgnored if I add one )
http://localhost/foo/bar/XMLData/123
on my browser.
Thanks much
You've overridden the XMLData endpoint to be accessed on xml/{id}, but you're calling it as XMLData/{id}.