Tuesday, June 30, 2015

Uploading Large Files to SharePoint



  1. Increase the Maximum Upload Size for the Web Application from Central Administration site
    • Browse to Central Administration site and click on Application Management
    • Click on 'Web Application General Settings' under 'SharePoint Web Application Management ' and choose the appropriate web application
    • Modify the value for 'Maximum Upload Size' property to specify the maximum size which is allowed for a single upload to any site under the web application.
      Note: You can choose multiple files and folders to be uploaded provided no single file or the collective size goes beyond 2 GB
    • A value of '1000' would set the max upload size to 1 GB. The maximum upload size cannot be increased beyond '2000' (2 Gb)
    • The default file size for upload is 50 Mb in IIS 6.0) and 28 Mb for IIS 7.0.

  1. Increase the connection time-out setting in IIS

    By default, the IIS connection time-out setting is 120 seconds (2 minutes). Follow these steps to increase the connection time-out setting:
    • In IIS manager, expand the 'Sites' node and select the SharePoint site
    • Click 'Advanced Settings' from the actions pane OR right-click the SharePoint site, Manage Web site and click 'Advanced Settings'
    • Increase the 'Connection time-out' value (seconds); under 'Connection limits' from the 'Advanced Settings' dialog box to avoid IIS time-outs when large files are being uploaded
    • You can specify the time-out value based on file size and the time taken for the file to be uploaded
    • You can also select the SharePoint site in IIS and click on the 'Limits' link in the actions pane.  
                     
  2. Increase the maximum upload size in the web.config file of web application

    The maxAllowedContentLength property specifies the maximum length of content in a request in bytes and it needs to be set on a Windows Server 2008 computer that has IIS 7.0-only installations.
To change the value of the property via web.config, do the following:
Open the web.config file of a web application located in %Inetpub%\Wwwroot\Wss\VirtualDirectories\<Virtual Directory> folder and add the following code at the bottom, just before the close out of the <configuration> section of the Web.config file
            <Configuration>
            ..
            ..
            <system.webServer>
                <Security>
                        <RequestFiltering>
                                   <requestLimits maxAllowedContentLength”52428800’/>
                        </requestFiltering>
                </security>
            </system.webServer>
            </configuration>
 This sets the value of the maxAllowedContentLength property to 52428800 (in bytes) for the web application only.
 To change the value of the property via command-line, do the following:   
    • Open command prompt and go to 'C:\windows\system32\inetsrv' directory
    • Run the below command:        

      Appcmd set config /section:requestfiltering /requestlimits.maxallowedcontentlength:unit
             
      Where the variable requestlimits.maxallowedcontentlength unit specifies the maximum length of content (in bytes). For example, to specify 2000000000 as the maximum length of content, type the following at the command prompt, and then press ENTER:

      Appcmd set config /section:requestfiltering /requestlimits.maxallowedcontentlength:2000000000
            

  1. Increase the default chunk size for large files
               
    the large-file-chunk-size property sets the amount of data that can be read from server running SQL Server at one time. Points to remember:            
    • If you have a file that is greater than your chunk size (such as 100 MB when the chunk size is set to 5 MB), the file would be read in 20 chunks (100 / 5).
    • The chunk size is not related to the maximum upload file size.
    • The chunk size simply specifies the amount of data that can be read from a file at one time. By default, the large-file-chunk-size property is set to 5 MB.
    • Be aware that if you set the chunk size too high, the files might use a high amount of memory of the web front-end.
In order to set the large–file–chunk–size property, we need to use the command line. This property is configured at a server or server farm level, and cannot be configured for an individual web application. To set this property, use the following syntax:

Stsadm.exe –o setproperty –pn large–file–chunk–size –pv <size in bytes>
               
  1. Add the ExecutionTimeout Value in the web.config
    • "12\TEMPLATE\LAYOUTS" folder

      Open the 'Web.config' file from the 'C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\TEMPLATE\LAYOUTS' directory. Add the executionTimeout value that you want. For example, replace the value as follows

      Existing code

      <location path="upload.aspx">
          <system.web>
              <httpRuntime maxRequestLength="2097151" />
          </system.web>
      </location>  

      Replacement Code

      <location path="upload.aspx">
          <system.web>
              <httpRuntime executionTimeout="999999" maxRequestLength="2097151" />
          </system.web>
      </location>  
    • Web App

      Open the web.config file located at 'C:\Inetpub\wwwroot\wss\VirtualDirectories\' folder and modify it as follows
       
      Existing line:             <httpRuntime maxRequestLength="51200" />          
      Replacement line:     <httpRuntime executionTimeout="999999" maxRequestLength="51200" />          
         
    • "12\CONFIG"

      Open the web.config located at "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG" and modify the 'maxRequestLength' property which by default should be the following:

       <httpRuntime maxRequestLength="51200"/>  

      Change the value to match the other web.configs          

  1. Save the file and perform an ' IISreset /noforce'.

No comments:

Post a Comment