File Upload Size
There are several features within uSync.Complete where you can upload data, either directly or between servers. When you do this, you might be uploading large amounts of data or media files and you can encounter a 404.13 error, 'request too large'. A request bigger than the site allows is refused before uSync sees it.
Two limits apply to these requests:
- uSync's own limit,
MaxRequestBodySize. It defaults to 500MB and uSync applies it to its own requests, so most sites never need to change it. See Changing the uSync limit. - The web server's limit. On IIS this is
maxAllowedContentLengthin web.config, which defaults to about 28.6MB. IIS checks it before the request reaches the site, so this is usually the one to raise.
IIS
On IIS, a request over maxAllowedContentLength fails with a 404.13 error (IIS Express reports it as 413.1).
From uSync.Complete 17.7.0, raising maxAllowedContentLength in web.config is all an IIS site needs to do. uSync raises ASP.NET Core's own limit for its requests up to MaxRequestBodySize.
Raise the limit for uSync only
You can raise the limit just for the paths uSync uses, so the rest of the site keeps the IIS default. Add a <location> block for each feature you use:
| Feature | Path |
|---|---|
| uSync.Publisher (requests between servers) | umbraco/uSyncReceive |
| uSync.Exporter (sync pack uploads) | umbraco/backoffice/usync/usyncnuexporterapi |
The web.config that dotnet publish creates puts the ASP.NET Core handler inside <location path="." inheritInChildApplications="false">. With that attribute in place, a separate <location> block doesn't get the handler, and IIS returns 404 for every uSync request. Remove inheritInChildApplications="false" from the . location when you add these blocks.
This is a sample web.config. Do not overwrite your own web.config, add only the required sections.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path=".">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\uSyncSiteName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
<location path="umbraco/uSyncReceive">
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</location>
<location path="umbraco/backoffice/usync/usyncnuexporterapi">
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
maxAllowedContentLength is in bytes; 1073741824 is 1GB. The highest value IIS accepts is 4294967295 (4GB).
Raise the limit for the whole site
If you'd rather not change the . location, add the request limit inside it instead. This raises the limit for every request to the site, not just requests from uSync:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
This goes in the <system.webServer> section, next to the <aspNetCore> element.
Versions before 17.7.0
Earlier versions only apply MaxRequestBodySize on Kestrel. On IIS, ASP.NET Core's own limit (also about 28.6MB) still applies after web.config is raised, so a large push fails while the receiving server reads the request. Raise that limit as well in Program.cs:
builder.Services.Configure<IISServerOptions>(options =>
{
options.MaxRequestBodySize = 1073741824;
});
Kestrel
When the site runs on Kestrel (on Linux, in a container, or behind a reverse proxy), uSync applies MaxRequestBodySize to its own requests and there's nothing else to set in the site. A reverse proxy in front of the site can have its own limit (client_max_body_size in nginx, for example), which needs to allow the same size.
Changing the uSync limit
MaxRequestBodySize is set in bytes, separately for Publisher and Exporter. The default is 500000000 (500MB). 0 removes uSync's limit, leaving only the web server's.
{
"uSync": {
"Publisher": {
"Settings": {
"MaxRequestBodySize": 1000000000
}
},
"Exporter": {
"Settings": {
"MaxRequestBodySize": 1000000000
}
}
}
}
The setting only ever raises the limit. If the site already allows bigger requests (through Umbraco's MaxRequestLength on Kestrel, or limits set in Program.cs), uSync requests keep the higher limit. It applies only to uSync's own requests; the rest of the site is unaffected. The highest value you can set is 2147483647 (about 2GB); for anything bigger, use 0.