I created a simple REST Service using the WCF REST Template 40(CS) which is working just fine. There only is a problem that the response uses "application/json" as content type but I need "text/plain".
The problem is already explained in a blog post but because of the template I'm not using a .svc file. So the proposed solution does not work for me.
My Service contract:
[ServiceContract]
public interface ICouchService
{
[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/", Method = "GET")]
ServiceInformation Hello();
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/piclib/{id}")]
CouchDocument GetDocument(string id);
}
web.config:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>