Open Closed

AbpApplicationConfigurationScript ArgumentOutOfRange Exception #9583


User avatar
0
mattw@agilenova.com created

Hello,

I have upgraded an environment to ABP 9.2.1 and am receiving an exception from the AbpApplicationConfigurationScript: System.ArgumentOutOfRangeException: (Parameter 'count') Actual value was 362.

I am observing this behavior in a production environment, while a staging environment seems to be working fine. Please advise on how to resolve this issue.

  • Exception message and full stack trace:
2025-07-08 09:39:09.089 -04:00 [Information] [Microsoft.AspNetCore.Routing.EndpointMiddleware] [{ Name: "ExecutingEndpoint" }] Executing endpoint '"Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc)"'
2025-07-08 09:39:09.089 -04:00 [Information] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker] [{ Id: 102, Name: "ControllerActionExecuting" }] Route matched with "{area = \"Abp\", action = \"Get\", controller = \"AbpApplicationConfigurationScript\", page = \"\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] Get()" on controller "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController" ("Volo.Abp.AspNetCore.Mvc").
2025-07-08 09:39:09.103 -04:00 [Information] [Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor] [{ Id: 1, Name: "ContentResultExecuting" }] Executing ContentResult with HTTP Response ContentType of "application/javascript"
2025-07-08 09:39:09.104 -04:00 [Error] [Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] [{ Id: 1, Name: "UnhandledException" }] An unhandled exception has occurred while executing the request.
System.ArgumentOutOfRangeException:  (Parameter 'count')
Actual value was 362.
   at Microsoft.AspNetCore.Http.SendFileFallback.SendFileAsync(Stream destination, String filePath, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Http.SendFileResponseExtensions.SendFileAsyncCore(HttpResponse response, String fileName, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Http.SendFileResponseExtensions.SendFileAsyncCore(HttpResponse response, IFileInfo file, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.StaticAssets.StaticAssetsInvoker.SendAsync(StaticAssetInvocationContext context)
   at Microsoft.AspNetCore.StaticAssets.StaticAssetsInvoker.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Volo.Abp.AspNetCore.Security.Claims.AbpDynamicClaimsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpOpenIddictMiddlewareExtension.<>c__DisplayClass0_0.<<UseAbpOpenIddictValidation>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
2025-07-08 09:39:09.108 -04:00 [Information] [Microsoft.AspNetCore.Routing.EndpointMiddleware] [{ Name: "ExecutingEndpoint" }] Executing endpoint '"Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)"'
  • Steps to reproduce the issue:

4 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To resolve the System.ArgumentOutOfRangeException from the AbpApplicationConfigurationScript endpoint after upgrading to ABP 9.2.1, follow these steps:

    1. Check for Static Asset Middleware Changes

      • ABP 9.x and .NET 9 introduced changes in static asset delivery. Ensure you are using the correct middleware for static files. In your Startup.cs or program setup, replace:
        app.UseStaticFiles();
        
        with:
        app.MapAbpStaticAssets();
        
      • This is required for proper static asset handling in ABP 9.x. See the migration guide for details.
    2. Review the Migration Guide

      • There are breaking changes in ABP 9.2.x. Review the official migration guide and ensure all required changes are applied:
        • Update all ABP NuGet and NPM packages to 9.2.1.
        • Check for any customizations or overrides in your solution that may affect static file or configuration script delivery.
        • Compare your production and staging environments for differences in static file configuration, file permissions, or deployment artifacts.
    3. Clear and Rebuild Static Assets

      • Delete the wwwroot or equivalent static assets output directory and rebuild your solution to ensure all assets are up to date.
      • If you use a CDN or reverse proxy, clear its cache.
    4. Check File System and Permissions

      • The error may occur if a static file is missing or has incorrect permissions. Verify that all files referenced by the application exist and are accessible by the application process.
    5. Review Application Configuration Script Endpoint

      • The /Abp/ApplicationConfigurationScript endpoint provides configuration for SPA clients. If you have customizations or middleware affecting this endpoint, review them for compatibility with ABP 9.2.1.
    6. Compare Environments

      • Since staging works but production fails, compare:
        • .NET SDK/runtime versions
        • File system structure and permissions
        • Environment variables and configuration files
    7. Check for Known Issues

      • Review the ABP 9.2 migration guide and community articles for any known issues related to static asset delivery or the ApplicationConfigurationScript endpoint.

    If the above steps do not resolve the issue, provide more details about custom middleware, deployment process, or any recent changes to static file handling.

    Sources:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    mattw@agilenova.com created

    I have performed the steps above and no changes were required. The problem persists and is occurring frequently. Here is some additional logs showing the exact endpoint:

    2025-07-08 10:17:45.391 -04:00 [Information] [Microsoft.AspNetCore.Routing.EndpointMiddleware] [{ Name: "ExecutingEndpoint" }] Executing endpoint '"Microsoft.AspNetCore.Routing.RouteEndpoint"' 2025-07-08 10:17:45.391 -04:00 [Information] [Microsoft.AspNetCore.Routing.EndpointMiddleware] [{ Id: 1, Name: "ExecutedEndpoint" }] Executed endpoint '"Microsoft.AspNetCore.Routing.RouteEndpoint"' 2025-07-08 10:17:45.395 -04:00 [Information] [Microsoft.AspNetCore.Hosting.Diagnostics] [{ Id: 1 }] Request starting **"HTTP/2" "GET" "https"://"REDACTED.COM:44389""""/Abp/ApplicationLocalizationScript""?cultureName=en" - null null 2025-07-08 10:17:45.398 -04:00 [Information] [Microsoft.AspNetCore.Routing.EndpointMiddleware] [{ Name: "ExecutingEndpoint" }] Executing endpoint **'"Volo.Abp.AspNetCore.Mvc.Localization.AbpApplicationLocalizationScriptController.GetAsync (Volo.Abp.AspNetCore.Mvc)"' 2025-07-08 10:17:45.398 -04:00 [Information] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker] [{ Id: 102, Name: "ControllerActionExecuting" }] Route matched with "{area = "Abp", action = "Get", controller = "AbpApplicationLocalizationScript", page = ""}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] GetAsync(Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto)" on controller "Volo.Abp.AspNetCore.Mvc.Localization.AbpApplicationLocalizationScriptController" ("Volo.Abp.AspNetCore.Mvc"). 2025-07-08 10:17:45.401 -04:00 [Error] [Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] [{ Id: 1, Name: "UnhandledException" }] An unhandled exception has occurred while executing the request. System.ArgumentOutOfRangeException: (Parameter 'count') Actual value was 362.

  • User Avatar
    0
    mattw@agilenova.com created

    Actually, I believe AI was right - #3 was the issue. After clearing my deployment directories and republishing, the exception was resolved.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks @mattw 👍

    The XXX.staticwebassets.endpoints.json of your project may break. Therefore, a rebuild will resolve the issue.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37