SP2010 Client Object Model 3 MB Limit - maxReceivedMessageSize Update Not Applicable

I use the Client Object Model to interact with Sharepoint 2010. When I tried to download documents larger than 3 MB using Client OM, it gave a Bad Request error. Microsoft suggests this to fix the problem. I tried this and updated the maxReceivedMessageSize property. It works fine after a system restart, but does not apply to a running sharepoint server.

I assume that since the setting could be stored in memory, the reset application is required, but I do not understand what to do with reset. I tried reselling various Sharepoint services. I tried renaming the Sharepoint site to IIS. Nothing helps.

Also, if I set a limit of 10 MB, for example, I can upload documents around 7.5 MB. I think this is due to additional metadata (properties such as content, etc.). Is this the correct behavior, or do I need to change something else.

Would thank for any help.

Sincerely.

+5
source share
3 answers

I found this entry in the TechNet Forum that helped me solve this problem:

SharePoint , .
Ø SharePoint, SharePoint 2010 1. "" " ".
2. Microsoft SharePoint 2010.
3. " SharePoint 2010".
Ø .

get-PSSnapin - Registered
Add-PSSnapin Microsoft.SharePoint.Powershell
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 2147483647
$ws.Update()

Asp.Net, , .
Ø web.config, '<httpRuntime> '.
, .
Ø 2147483647 - 1,99 .
<system.web>
<httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="2147483647" requestLengthDiskThreshold="2147483647" executionTimeout="18000"/> </system.web>

IIS 7.0 , .
web.config, '<requestLimits> '.
, .
<system.webServer>
 <modules runAllManagedModulesForAllRequests="true"/>
    <security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
</system.webServer>

, !

+5

SharePoint. , SharePoint. 2 , 50 .

3 :

  • , maxReceivedMessageSize.

  • SaveBinaryDirect

    SharePoint 2010. Distributed Authoring Versioning (DAV) PUT. , 50 .

    №2,

    string siteURL = "https://records.contoso.com";
    
    using (var context = new Microsoft.SharePoint.Client.ClientContext(siteURL))
    {
       context.Credentials = new NetworkCredential(
          "username", 
          "password", 
          "domain");
       string filePathToUpload = "C:\test\test.txt";
       context.ExecuteQuery();
    
       using (FileStream fs = new FileStream(filePathToUpload, FileMode.Open)
       {
          string targetURL = "/testsite/test.txt";
          Microsoft.SharePoint.Client.File.SaveBinaryDirect(
             context, 
             targetURL, 
             fs, 
             true);
       }
    }
    
  • SharePoint 2013 , REST API. 2 .

+2

, , , , :

public static void IncreaseMaxReceivedMessageSize ()
{
    SPWebService contentService = SPWebService.ContentService;

    /* Must set this to -1, else, the MaxReceivedMessageSize value for
    SPWebService.ContentService.WcfServiceSettings["client.svc"] will not be used.*/
    contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1;

    // SPWcfServiceSettings has other Properties that you can set.
    SPWcfServiceSettings csomWcfSettings = new SPWcfServiceSettings();
    csomWcfSettings.MaxReceivedMessageSize = 10485760; // 10MB
    contentService.WcfServiceSettings["client.svc"] = csomWcfSettings;

    contentService.Update();
}

please show your code by editing your question, and also explain which system you are rebooting into, and then it works as opposed to restarting or recycling SP sites on which you claim it does not work ...

0
source

All Articles