Skip to content

Issue with pushing content between servers - Request body size limit? #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Daniel127 opened this issue May 26, 2025 · 2 comments
Open

Comments

@Daniel127
Copy link

Daniel127 commented May 26, 2025

Hi team,

I'm encountering an issue when trying to push all content from one server to another. I'm getting the following error:

Image

I've configured the following in my Startup.cs thinking it would be sufficient, but I'm not sure if this is the correct approach or if I should have this configuration in a web.config file as mentioned in the guide.

Here's the code I've added:

public class CustomLimitMiddleware : IMiddleware
{
    public async Task InvokeAsync(HttpContext context, RequestDelegate next)
    {
        var httpMaxRequestBodySizeFeature = context.Features.Get<Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature>();
        if (httpMaxRequestBodySizeFeature is { IsReadOnly: false })
        {
            httpMaxRequestBodySizeFeature.MaxRequestBodySize = 524288000L; //500 MB
        }

        await next.Invoke(context);
    }
}
var pathsWithCustomLimit = new[]
{
    "/umbraco/uSyncReceive",
    "/umbraco/backoffice/uSync/uSyncNuExporterApi"
};

app.UseWhen(
    predicate: context => pathsWithCustomLimit.Any(pathPrefix =>
        context.Request.Path.StartsWithSegments(pathPrefix, StringComparison.OrdinalIgnoreCase)),
    configuration: applicationBuilder => applicationBuilder.UseMiddleware<CustomLimitMiddleware>()
);

Could you please let me know if this configuration might be causing the issue, or if it could be something else?

Thanks!

@KevinJump
Copy link
Member

Hi,

I am not 100% sure if the middleware stuff will always get hit when using IIS, or indeed if there is an order thing to it (I'm just not up to speed fully with that config). I would try the web.config settings see if that fixes it,

@Daniel127
Copy link
Author

Hi,

When I add the configuration to the web.config, the servers fail. They look like this, and I see a NotFound error in the call they make. I can access the Back Office without any issues, but I can't perform a synchronization.

Image

This is my web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\App.ContentManager.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
  <location path="umbraco/uSyncReceive">
    <system.web>
      <httpRuntime maxRequestLength="512000"/>
    </system.web>
    <system.webServer>
      <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="524288000" />
        </requestFiltering>
      </security>
    </system.webServer>
  </location>
  <location path="umbraco/backoffice/uSync/uSyncNuExporterApi">
    <system.web>
      <httpRuntime maxRequestLength="512000"/>
    </system.web>
    <system.webServer>
      <security>
      <requestFiltering>
          <requestLimits maxAllowedContentLength="524288000" />
      </requestFiltering>
      </security>
    </system.webServer>
  </location>
</configuration>

I don't know what I might have wrong or where to look for it. The Umbraco log isn't telling me anything.

Do you have any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants