# WCF service request limit

I have setup a WCf service in my project using this tutorial: http://msdn.microsoft.com/en-us/library/ff521581.aspx

However, I'm POSTing lots of byte[] data to the service tocreate a file. I basically have a canvas drawing, which I convert to byte[] using javascript and then POST it to the server to create a new file.

However, this approach is flawed. The server errors out if the the byte data is big. I followed the turorial and could not find a way to increase the limits. I did find ways to modify Web.Config file, but my WCF service does not has a web.config file.

Any help is greatly appreciated!

-
This may be better suited for Stack Overflow –  RJ Cuthbertson Jul 23 '12 at 19:57
Since the tutorial for setting up a wcf service based on SharePoint SharePoint, I thought it was best to post here. I will play around a bit, and post my results here. Because the way MSDN has that tutorial, I'm pretty sure a lot of people will have problem setting up configurations for the wcf service. –  harsimranb Jul 23 '12 at 20:14
I know what you're saying, and the rules of these forums are kind of convoluted. However, this is more specifically about WCF and IIS than about SharePoint. –  RJ Cuthbertson Jul 23 '12 at 20:24
You might find there is a web.config, you should check in the c:\inetpub\wwwroot\wss\virtualdirectories\<your web>\web.config –  Ian Jul 23 '12 at 20:50

You cannot use web.config to change the settings for the SharePoint WCF services because the Factory classes referenced in the *.svc file do the configuration 'automatically'.

But you can use the SPWcfServiceSettings class to modify the quotas. (Note: This changes the quotas for all WCF services in the Farm that use the factory classes).

Here is an example on how to use the class: http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=121

-
I ended up implementing a Geneirc Handler, which did not impose any limits. Since I'm working on a client project, I really don't want my WCF service quotas to affect all WCF services on the farm. Thanks for pointing that out though! –  harsimranb Jul 24 '12 at 22:12
Where should I use SPWcfServiceSettings? –  Codler Nov 14 '12 at 12:38

I solved this by creating a Feature and then add this code in FeatureInstalled method.

public override void FeatureInstalled(SPFeatureReceiverProperties properties)
{
SPWebService contentService = SPWebService.ContentService;
SPWcfServiceSettings wcfServiceSettings = new SPWcfServiceSettings();

// Note: "runtime.svc" must be in lowercase
contentService.WcfServiceSettings["runtime.svc"] = wcfServiceSettings;

contentService.Update(true);
}

-

I eneded up implementing a Generic Handler (.ashx), which did not impose any limits to the data I was POSTing.