Base solution for your next web application
Open Closed

AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID ..., Request ID ...: An unhandled exception was thrown by the application. System.InvalidOperationException: Response already started #10976


User avatar
0
pliaspzero created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 10.2
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

If issue related with ABP Framework

  • What is ABP Framework version?

If issue is about UI

Hi, on customer server, we get every few seconds the below error:

"AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID "16573246634629036021", Request ID "8000781f-0001-e600-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.InvalidOperationException: Response already started"

Details here. Any idea what is the reason and how to fix that? Server is IIS, Angular app is separatly hosted in own domain. Also every app - Anglaur and .NET core has own App Pools.

ERROR 2022-03-21 11:13:36,858 [158 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred while executing the request. System.InvalidOperationException: Response already started at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.OnStarting(Func2 callback, Object state) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at WFMOne.Web.Startup.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in /home/vsts/work/1/s/src/WFMOne.Web.Host/Startup/Startup.cs:line 277 --- End of stack trace from previous location --- at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) ERROR 2022-03-21 11:13:36,859 [158 ] AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID "16573246634629036021", Request ID "8000781f-0001-e600-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.InvalidOperationException: Response already started at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.OnStarting(Func2 callback, Object state) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at WFMOne.Web.Startup.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in /home/vsts/work/1/s/src/WFMOne.Web.Host/Startup/Startup.cs:line 277 --- End of stack trace from previous location --- at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT1.ProcessRequestAsync() ERROR 2022-03-21 11:14:14,190 [152 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred while executing the request. System.InvalidOperationException: Response already started at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.OnStarting(Func2 callback, Object state) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at WFMOne.Web.Startup.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in /home/vsts/work/1/s/src/WFMOne.Web.Host/Startup/Startup.cs:line 277 --- End of stack trace from previous location --- at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)


8 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you share what is on Startup.cs:line 277 ?

    Thanks,

  • User Avatar
    0
    pliaspzero created
      Here is my Configure part - below the whole statup class 
      
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
    
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
                app.UseExceptionHandler("/Error");
            }
    
            app.UseStaticFiles();
            Bold.Licensing.BoldLicenseProvider.RegisterLicense("KbGuIWrFfeANDDqWuWDs5zYZuVLojmxIxYWupqW3Vg0=");
            ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List&lt;string&gt; { "BoldReports.Data.WebData" });
            app.UseSpaStaticFiles();
    
            //Initializes ABP framework.
            app.UseAbp(options =>
         {
             options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization
         });
    
    
    
            app.Use(async (context, next) =>
            {
                await next();
                if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; await next(); }
    
            });
            app.UseStaticFiles();
            app.UseRouting();
    
            app.UseCors(DefaultCorsPolicyName); //Enable CORS!
                                                // app.UseCors("AllowAllOrigins");
    
            app.UseAuthentication();
            app.UseJwtTokenMiddleware();
    
            var isAttendanceFeatureAvailable = bool.Parse(_appConfiguration["App:IsAccessControlFeatureAvailable"]);
    
            if (isAttendanceFeatureAvailable)
                app.UseRabbitListener();
    
            if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
            {
                app.UseJwtTokenMiddleware("IdentityBearer");
                app.UseIdentityServer();
            }
    
            app.UseAuthorization();
    
            using (var scope = app.ApplicationServices.CreateScope())
            {
                if (scope.ServiceProvider.GetService&lt;DatabaseCheckHelper&gt;().Exist(_appConfiguration["ConnectionStrings:Default"]))
                {
                    app.UseAbpRequestLocalization();
                }
            }
            //using (var scope = app.ApplicationServices.CreateScope())
            //{
            //    if (scope.ServiceProvider.GetService&lt;DatabaseCheckHelper&gt;().IsPocDbExists(_appConfiguration["ConnectionStrings:POCDb"]))
            //    {
            //        app.UseAbpRequestLocalization();
            //    }
            //}
    
            if (WebConsts.HangfireDashboardEnabled)
            {
                //Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
                app.UseHangfireDashboard(WebConsts.HangfireDashboardEndPoint, new DashboardOptions
                {
                    Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
                });
                app.UseHangfireServer();
            }
    
            if (bool.Parse(_appConfiguration["Payment:Stripe:IsActive"]))
            {
                StripeConfiguration.ApiKey = _appConfiguration["Payment:Stripe:SecretKey"];
            }
    
            if (WebConsts.GraphQL.Enabled)
            {
                app.UseGraphQL&lt;MainSchema&gt;();
                if (WebConsts.GraphQL.PlaygroundEnabled)
                {
                    app.UseGraphQLPlayground(
                        new GraphQLPlaygroundOptions()); //to explorer API navigate https://*DOMAIN*/ui/playground
                }
            }
    
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHub&lt;AbpCommonHub&gt;("/signalr");
                endpoints.MapHub&lt;ChatHub&gt;("/signalr-chat");
    
                endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
    
                if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
                {
                    endpoints.MapHealthChecks("/health", new HealthCheckOptions()
                    {
                        Predicate = _ => true,
                        ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                    });
                }
            });
    
            if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
            {
                if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksUI:HealthChecksUIEnabled"]))
                {
                    app.UseHealthChecksUI();
                }
            }
    
            if (WebConsts.SwaggerUiEnabled)
            {
                // Enable middleware to serve generated Swagger as a JSON endpoint
                app.UseSwagger();
                // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
    
                app.UseSwaggerUI(options =>
                {
                    options.SwaggerEndpoint(_appConfiguration["App:SwaggerEndPoint"], "WFMOne API V1");
                    options.IndexStream = () => Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("WFMOne.Web.wwwroot.swagger.ui.index.html");
                    options.InjectBaseUrl(_appConfiguration["App:ServerRootAddress"]);
                }); //URL: /swagger
            }
        }
    }
    
  • User Avatar
    0
    pliaspzero created
    ############################################################################
    Complete startup:
    ############################################################################
    
      public class Startup
    {
        private const string DefaultCorsPolicyName = "localhost";
    
        private readonly IConfigurationRoot _appConfiguration;
        private readonly IWebHostEnvironment _hostingEnvironment;
    
        public Startup(IWebHostEnvironment env)
        {
            _hostingEnvironment = env;
            _appConfiguration = env.GetAppConfiguration();
        }
    
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
           
    
            // Add SAML SSO services.
            services.AddSaml(_appConfiguration.GetSection("SAML"));
    
            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "wwwroot/dist";
            });
    
            //MVC
            services.AddControllersWithViews(options =>
            {
                options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
            }).AddNewtonsoftJson();
    
            services.AddSignalR(options => { options.EnableDetailedErrors = true; });
            //Configure CORS for angular2 UI
            services.AddCors(options =>
               {
    
                   var corsOrigin = _appConfiguration["App:CorsOrigins"]
                                .Split(",", StringSplitOptions.RemoveEmptyEntries)
                                .Select(o => o.RemovePostFix("/"))
                                .ToArray();
    
                   options.AddPolicy(DefaultCorsPolicyName, builder =>
                {
                    //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                    builder
                           .WithOrigins(
                               // App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
                               corsOrigin
                           )
                           .SetIsOriginAllowedToAllowWildcardSubdomains()
                           .AllowAnyHeader()
                           .AllowAnyMethod()
                           .AllowCredentials();
                });
    
               });
    
            services.AddCors(options =>
            {
                options.AddPolicy("AllowAllOrigins", builder =>
                {
                    builder.AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowAnyHeader();
                });
            });
    
            services.AddControllers();
    
            var isAttendanceFeatureAvailable = bool.Parse(_appConfiguration["App:IsAccessControlFeatureAvailable"]);
    
            IdentityRegistrar.Register(services);
            AuthConfigurer.Configure(services, _appConfiguration);
    
            if (isAttendanceFeatureAvailable)
            {
                services.AddSingleton&lt;RabbitMQPersistentConnection&gt;(sp =>
                {
                    var logger = sp.GetRequiredService&lt;ILogger&lt;RabbitMQPersistentConnection&gt;>();
    
    
    
                    var factory = new ConnectionFactory()
                    {
                        HostName = _appConfiguration["EventBusConnection"]
                    };
    
    
    
                    if (!string.IsNullOrEmpty(_appConfiguration["EventBusUserName"]))
                    {
                        factory.UserName = _appConfiguration["EventBusUserName"];
                    }
    
    
    
                    if (!string.IsNullOrEmpty(_appConfiguration["EventBusPassword"]))
                    {
                        factory.Password = _appConfiguration["EventBusPassword"];
                    }
                    if (!string.IsNullOrEmpty(_appConfiguration["EventBusPassword"]))
                    {
                        factory.Ssl.ServerName = _appConfiguration["EventBusConnection"];
                    }
                    if (!string.IsNullOrEmpty(_appConfiguration["EventBusPassword"]))
                    {
                        factory.Ssl.Enabled = true;
                    }
    
                    var url = _appConfiguration["NotificationUrl"];
    
                    return new RabbitMQPersistentConnection(factory, url);
                });
            }
            //Identity server
            if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
            {
                IdentityServerRegistrar.Register(services, _appConfiguration, options =>
                     options.UserInteraction = new UserInteractionOptions()
                     {
                         LoginUrl = "/UI/Login",
                         LogoutUrl = "/UI/LogOut",
                         ErrorUrl = "/Error"
                     });
            }
    
            if (WebConsts.SwaggerUiEnabled)
            {
                //Swagger - Enable this line and the related lines in Configure method to enable swagger UI
                services.AddSwaggerGen(options =>
                {
                  
                    options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
                    options.SwaggerDoc("v1", new OpenApiInfo() { Title = "WFMOne API", Version = "v1" });
                    options.DocInclusionPredicate((docName, description) => true);
                    options.ParameterFilter&lt;SwaggerEnumParameterFilter&gt;();
                    options.SchemaFilter&lt;SwaggerEnumSchemaFilter&gt;();
                    options.OperationFilter&lt;SwaggerOperationIdFilter&gt;();
                    options.OperationFilter&lt;SwaggerOperationFilter&gt;();
                   options.CustomSchemaIds(type => type.FullName);
                   options.CustomDefaultSchemaIdSelector();
                }).AddSwaggerGenNewtonsoftSupport();
            }
    
            //Recaptcha
            services.AddRecaptcha(new RecaptchaOptions
            {
                SiteKey = _appConfiguration["Recaptcha:SiteKey"],
                SecretKey = _appConfiguration["Recaptcha:SecretKey"]
            });
    
            if (WebConsts.HangfireDashboardEnabled)
            {
                //Hangfire(Enable to use Hangfire instead of default job manager)
                services.AddHangfire(config =>
                {
                    config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
                });
            }
    
            if (WebConsts.GraphQL.Enabled)
            {
                services.AddAndConfigureGraphQL();
            }
    
            if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
            {
                services.AddAbpZeroHealthCheck();
    
                var healthCheckUISection = _appConfiguration.GetSection("HealthChecks")?.GetSection("HealthChecksUI");
    
                if (bool.Parse(healthCheckUISection["HealthChecksUIEnabled"]))
                {
                    services.Configure&lt;HealthChecksUISettings&gt;(settings =>
                    {
                        healthCheckUISection.Bind(settings, c => c.BindNonPublicProperties = true);
                    });
                    services.AddHealthChecksUI();
                }
            }
    
         //Configure Abp and Dependency Injection
         return services.AddAbp&lt;WFMOneWebHostModule&gt;(options =>
            {
                //Configure Log4Net logging
                options.IocManager.IocContainer.AddFacility&lt;LoggingFacility&gt;(
                    f => f.UseAbpLog4Net().WithConfig(_hostingEnvironment.IsDevelopment()
                            ? "log4net.config"
                            : "log4net.Production.config")
                );
    
                options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.WebRootPath, "Plugins"), SearchOption.AllDirectories);
            });
        }
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
    
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
                app.UseExceptionHandler("/Error");
            }
    
            app.UseStaticFiles();
            Bold.Licensing.BoldLicenseProvider.RegisterLicense("KbGuIWrFfeANDDqWuWDs5zYZuVLojmxIxYWupqW3Vg0=");
            ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List&lt;string&gt; { "BoldReports.Data.WebData" });
            app.UseSpaStaticFiles();
    
            //Initializes ABP framework.
            app.UseAbp(options =>
         {
             options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization
         });
    
    
    
            app.Use(async (context, next) =>
            {
                await next();
                if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; await next(); }
    
            });
            app.UseStaticFiles();
            app.UseRouting();
    
            app.UseCors(DefaultCorsPolicyName); //Enable CORS!
                                                // app.UseCors("AllowAllOrigins");
    
            app.UseAuthentication();
            app.UseJwtTokenMiddleware();
    
            var isAttendanceFeatureAvailable = bool.Parse(_appConfiguration["App:IsAccessControlFeatureAvailable"]);
    
            if (isAttendanceFeatureAvailable)
                app.UseRabbitListener();
    
            if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
            {
                app.UseJwtTokenMiddleware("IdentityBearer");
                app.UseIdentityServer();
            }
    
            app.UseAuthorization();
    
            using (var scope = app.ApplicationServices.CreateScope())
            {
                if (scope.ServiceProvider.GetService&lt;DatabaseCheckHelper&gt;().Exist(_appConfiguration["ConnectionStrings:Default"]))
                {
                    app.UseAbpRequestLocalization();
                }
            }
            //using (var scope = app.ApplicationServices.CreateScope())
            //{
            //    if (scope.ServiceProvider.GetService&lt;DatabaseCheckHelper&gt;().IsPocDbExists(_appConfiguration["ConnectionStrings:POCDb"]))
            //    {
            //        app.UseAbpRequestLocalization();
            //    }
            //}
    
            if (WebConsts.HangfireDashboardEnabled)
            {
                //Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
                app.UseHangfireDashboard(WebConsts.HangfireDashboardEndPoint, new DashboardOptions
                {
                    Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
                });
                app.UseHangfireServer();
            }
    
            if (bool.Parse(_appConfiguration["Payment:Stripe:IsActive"]))
            {
                StripeConfiguration.ApiKey = _appConfiguration["Payment:Stripe:SecretKey"];
            }
    
            if (WebConsts.GraphQL.Enabled)
            {
                app.UseGraphQL&lt;MainSchema&gt;();
                if (WebConsts.GraphQL.PlaygroundEnabled)
                {
                    app.UseGraphQLPlayground(
                        new GraphQLPlaygroundOptions()); //to explorer API navigate https://*DOMAIN*/ui/playground
                }
            }
    
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHub&lt;AbpCommonHub&gt;("/signalr");
                endpoints.MapHub&lt;ChatHub&gt;("/signalr-chat");
    
                endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
    
                if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
                {
                    endpoints.MapHealthChecks("/health", new HealthCheckOptions()
                    {
                        Predicate = _ => true,
                        ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                    });
                }
            });
    
            if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
            {
                if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksUI:HealthChecksUIEnabled"]))
                {
                    app.UseHealthChecksUI();
                }
            }
    
            if (WebConsts.SwaggerUiEnabled)
            {
                // Enable middleware to serve generated Swagger as a JSON endpoint
                app.UseSwagger();
                // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
    
                app.UseSwaggerUI(options =>
                {
                    options.SwaggerEndpoint(_appConfiguration["App:SwaggerEndPoint"], "WFMOne API V1");
                    options.IndexStream = () => Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("WFMOne.Web.wwwroot.swagger.ui.index.html");
                    options.InjectBaseUrl(_appConfiguration["App:ServerRootAddress"]);
                }); //URL: /swagger
            }
        }
    }
    public static class ApplicationBuilderExtentions
    {
        public static RabbitMQPersistentConnection Listener { get; set; }
    
    
    
        public static IApplicationBuilder UseRabbitListener(this IApplicationBuilder app)
        {
            Listener = app.ApplicationServices.GetService&lt;RabbitMQPersistentConnection&gt;();
            var life = app.ApplicationServices.GetService&lt;Microsoft.Extensions.Hosting.IApplicationLifetime&gt;();
            life.ApplicationStarted.Register(OnStarted);
    
    
    
            //press Ctrl+C to reproduce if your app runs in Kestrel as a console app
            life.ApplicationStopping.Register(OnStopping);
            return app;
        }
    
    
    
        private static void OnStarted()
        {
            Listener.CreateConsumerChannel();
        }
    
    
    
        private static void OnStopping()
        {
            Listener.Disconnect();
        }
    }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @pliaspzero

    I tihnk there are also using statements in the Startup.cs, so it is hard to find which line is which. Could you share your Startp.cs file to [email protected] as an attachment ? We will help you via email.

    Thanks,

  • User Avatar
    0
    henryand created

    Could you provide a follow-up here? We also have "Response already started" littering our log files.

    the error message references the following line in Startup.cs

    app.Use(async (context, next) => { await next(); if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; await next(); } });

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @henryand

    Do you host the Angular app and Host app under the same domain ?

  • User Avatar
    0
    olmy90 created

    no - 2 sub domains

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    In that case, you can remove the below code block from your app;

    app.Use(async (context, next) => { await next(); if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; await next(); } });
    

    This is only needed if you are hosting both apps under the same website.