Reputation: 17930
I have a client that creates thousands of entities and sends it over to the service like so :
for(int i=0;i<99999999; i++)
{
var contract = new Contract { Id = i, Name = "Ctr" + i.ToString() , ... }
service.AddToContracts(contract);
}
svc.SaveChanges(SaveChangesOptions.Batch);
the problem is that when I try to save the changes, I get the following exception :
"400 - Bad Request"
Upvotes: 1
Views: 830
Reputation: 33139
WCF Data Services isn't very good at writing large amounts of data.
I got into trouble about a year ago when my code tried to write 100,000 objects... I modified the code to add the objects in smaller chunks (losing the transactional nature of my operation), which worked.
Upvotes: 2
Reputation: 7876
You can enable tracing on your service to get the exact error on where your request is failing and what is the cause for it? If there are many number of entities being passed to your WCF Service try to increase the following settings in your web.config
<dataContractSerializer maxObjectsInGraph="1000000000"/>
Also would be easy if you can post your service configuration.
Upvotes: 0
Reputation: 12804
Don't save as a batch only at the end and instead save every 100 contracts added or something.
Upvotes: 1