I'm currently using WCF Data Services (well, ADO.Net Data Services) with Entity Framework and am getting the following error when performing a POST (omitted / changed some irrelevant info):
<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code /><m:message xml:lang="en-GB">The URI 'http://localhost:56568/MyWcfDataServices.svc/EntitySetName(pk_id)' is not valid for POST operation. For POST operations, the URI must refer to a service operation or an entity set.</m:message></m:error>
Having a look around online, I can't seem to find much information about this message so debugging it is a little difficult. It's likely happening because one of the attributes I'm posting is a large base64 string (it works fine if I don't post this). I've tried setting the maxRequestLength
to the following:
<httpRuntime maxRequestLength="102400" />
But it doesn't seem to have helped. While I'll continue working through this, I thought I'd make a quick post on here to see if anyone knows something that may help.
My WCF Data Service class looks like this:
public class MyWcfDataServices: DataService<ContextName>
{
public static void InitializeService(DataServiceConfiguration config)
{
// set entity access rules etc
}
}
Thanks
EDIT: I don't seem to be getting anywhere with this. Here's what I've tried so far.
On the server side I've set the following bindings:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
minFreeMemoryPercentageToActivateService="0" />
<services>
<service name="MyWcfDataServices"
behaviorConfiguration="myBehaviorConfig">
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration=""
contract="System.Data.Services.IRequestHandler" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myBehaviorConfig">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Hoping that the maxItemsInObjectGraph
attribute would be the solution. Do these bindings look correct? Am I missing some attribute that will let me POST more data to the server? Do I need to configure this service behavior on the client as well?