Kentico allows you to limit the size of files that are synchronized by staging. Files that support staging include:
You can set a size limit to prevent the system from using too many resources by synchronizing files that are too large. You can also increase the limits if you need to stage files that are larger than is allowed by default.
The system only logs staging tasks for files when the changes are performed via the Kentico administration interface. If you make changes directly in the file system, for example upload or update files using FTP, the changes are not logged.
If you make a change to a file via the administration interface and then update the file using FTP, the current file (the one updated using FTP) will be transferred to the target server, even if the staging task was created before the file upload. This happens because the system loads the binary data of the files at the time of synchronization, not when the synchronization task is logged.
Changing the maximum content and request size
One way to restrict staging of files is to adjust the limits of the maximum request size for the staging service:
- On the target server, edit the web.config file in the CMS folder of the web project.
- Add a <location> element for the staging service into the <configuration> section and set the following attributes:
maxRequestLength (<httpRuntime> element under <system.web>). The value is in kiloBytes.
maxAllowedContentLength (<security>/<requestFiltering>/<requestLimits> element under <system.webServer>). The value is in Bytes.
<location path="CMSPages/Staging"> <system.web> <httpRuntime executionTimeout="2400" maxRequestLength="4096" /> </system.web> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="4096648" /> </requestFiltering> </security> </system.webServer> </location>
Note: The default web.config already contains a <httpRuntime> and <requestLimits> tag under a location element that only affects WebDAV configuration. These default tags do NOT affect the request limits for staging or the application in general.
Save the web.config file.
Synchronizing files larger than the set value results in failure (the target server returns an HTTP status 404: Not Found error).
Important: The binary data of files only forms a part of the synchronization requests. You may need to set a higher maximum value than the file size that you wish to allow.
You can also configure the limits on the source server by setting the maxRequestLength and maxAllowedContentLength attributes inside the main <system.web> and <system.webServer> sections of the web.config (NOT within a specific <location> section).
This affects all types of requests, not just the staging service.
Limiting maximum media library file size
To limit the maximum size of files staged from media libraries:
- On the source server, edit the web.config file in the CMS folder of the web project.
Add the CMSMediaFileMaxStagingSize key into the <appSettings> section of the web.config. The value is in kiloBytes.
<add key="CMSMediaFileMaxStagingSize" value="102400" />
- Save the web.config file.
The system does not synchronize media library files above the limit — the synchronization only transfers the database definitions of the media objects without the files. You can find records of files not being synchronized in the Event log.
Was this page helpful?