Issues loading admin tab content after .NET 6 upgrade.

Vote:
 

Hey guys, I've been doing a .Net 6 upgrade to our Optimizely solution and have found a few issues in the CMS that I'm struggling to figure out. The site is working ok apart from a few areas of the CMS, most notable the Admin tabs seem to all be blank. I've tried upgrading all epi packages I can think of that may effect this and have had to do some minor refactoring in places but nothing that would cause these pages to break.

I get the following error upon any call to EPiServer/EPiServer.Cms.UI.Admin/ {"net::ERR_HTTP2_PROTOCOL_ERROR 200".}. I'm unable to upload a screen shot with my current account but the Chrome console will spit out an error like so

admin.bundle.js:631          GET https://domain/EPiServer/EPiServer.Cms.UI.Admin/ScheduledJobs/List net::ERR_HTTP2_PROTOCOL_ERROR 200
(anonymous) @ admin.bundle.js:631
e.exports @ admin.bundle.js:631
e.exports @ admin.bundle.js:1315
Promise.then (async)
l.request @ admin.bundle.js:1315
r.forEach.l.<computed> @ admin.bundle.js:1315
(anonymous) @ admin.bundle.js:631
(anonymous) @ admin.bundle.js:1353
(anonymous) @ admin.bundle.js:1353
(anonymous) @ admin.bundle.js:1353
(anonymous) @ admin.bundle.js:1353
r @ admin.bundle.js:1353
t.fetchScheduleJobs @ admin.bundle.js:1353
(anonymous) @ admin.bundle.js:1171
(anonymous) @ admin.bundle.js:458
n.condition.n.condition.getState @ admin.bundle.js:458
(anonymous) @ admin.bundle.js:458
Object.assign.pending @ admin.bundle.js:458
(anonymous) @ admin.bundle.js:458
dispatch @ VM519:3665
(anonymous) @ admin.bundle.js:1353
as @ admin.bundle.js:1299
gl @ admin.bundle.js:1299
t.unstable_runWithPriority @ admin.bundle.js:1307
Ba @ admin.bundle.js:1299
ml @ admin.bundle.js:1299
Qs @ admin.bundle.js:1299
(anonymous) @ admin.bundle.js:1299
t.unstable_runWithPriority @ admin.bundle.js:1307
Ba @ admin.bundle.js:1299
Ga @ admin.bundle.js:1299
Va @ admin.bundle.js:1299
tl @ admin.bundle.js:1299
Bl @ admin.bundle.js:1299
t.render @ admin.bundle.js:1299
(anonymous) @ admin.bundle.js:1283
n @ admin.bundle.js:1
(anonymous) @ admin.bundle.js:1
(anonymous) @ admin.bundle.js:1

While on the .NET side of things I will recieve an error like so in the console

[12:53:38 ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Headers are read-only, response has already started.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpHeaders.ThrowHeadersReadOnlyException()
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpHeaders.Microsoft.AspNetCore.Http.IHeaderDictionary.set_Item(String key, StringValues value)
   at Microsoft.AspNetCore.Http.ParsingHelpers.SetHeaderUnmodified(IHeaderDictionary headers, String key, Nullable`1 values)
   at Microsoft.AspNetCore.Http.ParsingHelpers.AppendHeaderUnmodified(IHeaderDictionary headers, String key, StringValues values)
   at WebMarkupMin.AspNet.Common.Compressors.CompressorExtensions.AppendHttpHeaders(ICompressor compressor, Action`2 append)
   at WebMarkupMin.AspNetCore6.BodyWrapperStreamBase.ModifyHttpHeadersForCompressionOnce()
   at WebMarkupMin.AspNetCore6.BodyWrapperStreamBase.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
   at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
   at EPiServer.Formatters.Internal.ExtendedSystemTextJsonOutputFormatter.WriteAsync(OutputFormatterWriteContext context, ResponseDecorator responseDecorator)
   at EPiServer.Shell.Web.Mvc.JsonDataResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Jotun.Sites.Web.Startup.<>c.<<Configure>b__4_2>d.MoveNext() in C:\Projects\Jotun\jotun-dotnet-episerver-sites\src\Jotun.Sites.Web\Startup.cs:line 461
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at React.AspNet.BabelFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
warn: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[2]
      The response has already started, the error page middleware will not be executed.

Does anyone have any idea on what could be causing this?

These are the packages I'm currently using in the project

<ItemGroup>

    <PackageReference Include="Advanced.CMS.AdvancedReviews" Version="1.1.2" />

    <PackageReference Include="CacheManager.Core" Version="2.0.0-beta-1629" />

    <PackageReference Include="CacheManager.Microsoft.Extensions.Configuration" Version="2.0.0-beta-1629" />

    <PackageReference Include="CacheManager.SystemRuntimeCaching" Version="1.2.0" />
    <PackageReference Include="DbLocalizationProvider.AdminUI.EPiServer" Version="7.3.0" />
    <PackageReference Include="dotcentric.Optimizely.Unpublish" Version="1.0.0" />
    <PackageReference Include="EPiServer.CloudPlatform.Cms" Version="1.0.5" />
    <PackageReference Include="EPiServer.CloudPlatform.Commerce" Version="1.0.2" />
    <PackageReference Include="EPiServer.CMS" Version="12.7.0" />
    <PackageReference Include="EPiServer.CMS.Core" Version="12.7.0" />
    <PackageReference Include="EPiServer.CMS.UI.Core" Version="12.7.0" />
    <PackageReference Include="EPiServer.Commerce" Version="14.4.0" />
    <PackageReference Include="EPiServer.ContentDeliveryApi.Cms" Version="3.3.0" />
    <PackageReference Include="EPiServer.ContentDeliveryApi.Commerce" Version="3.0.0-pre-000226" />
    <PackageReference Include="EPiServer.ContentDeliveryApi.OpenIDConnect" Version="3.0.0-ci-002437" />
    <PackageReference Include="EPiServer.Find.Cms" Version="14.1.0" />
    <PackageReference Include="EPiServer.Find.Commerce" Version="12.1.0" />
    <PackageReference Include="EPiServer.Forms" Version="5.2.0" />
    <PackageReference Include="EPiServer.Forms.UI" Version="5.2.0" />
    <PackageReference Include="EPiServer.Framework" Version="12.7.0" />
    <PackageReference Include="EPiServer.Labs.LanguageManager" Version="5.1.0" />
    <PackageReference Include="Geta.NotFoundHandler.Optimizely" Version="2.0.0" />
    <PackageReference Include="JavaScriptEngineSwitcher.V8" Version="3.18.3" />
    <PackageReference Include="LocalizationProvider.Storage.SqlServer" Version="7.3.0" />
    <PackageReference Include="DbLocalizationProvider.EPiServer" Version="7.3.0" />
    <PackageReference Include="LocalizationProvider.AdminUI.AspNetCore" Version="7.3.0" />
    <PackageReference Include="Geta.Optimizely.Sitemaps.Commerce" Version="2.0.0" />
    <PackageReference Include="Geta.Optimizely.Sitemaps" Version="2.0.0" />
    <PackageReference Include="MediatR" Version="10.0.1" />
    <PackageReference Include="Microsoft.ApplicationInsights.Profiler.AspNetCore" Version="2.4.0" />
    <PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" />
    <PackageReference Include="Microsoft.ClearScript.V8.Native.linux-x64" Version="7.3.0" />
    <PackageReference Include="Microsoft.ClearScript.V8.Native.osx-x64" Version="7.3.0" />
    <PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.3.0" /> 
    <PackageReference Include="React.AspNet" Version="5.2.12" />
    <PackageReference Include="React.Router" Version="5.2.12" />
    <PackageReference Include="JavaScriptEngineSwitcher.Extensions.MsDependencyInjection" Version="3.3.0" />
    <PackageReference Include="CorrelationId" Version="3.0.1" />
    <PackageReference Include="Refit.HttpClientFactory" Version="6.3.2" />
    <PackageReference Include="Serilog" Version="2.11.0" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
    <PackageReference Include="Serilog.Sinks.AzureApp" Version="3.1.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
    <PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
    <PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
    <PackageReference Include="System.Linq.Async" Version="6.0.1" />
    <PackageReference Include="TSC.Client.Optimizely" Version="4.0.3" />
    <PackageReference Include="WebMarkupMin.AspNetCore6" Version="2.11.0" />
  </ItemGroup>
#282557
Jun 27, 2022 15:05
Vote:
 

Hi, what is React.AspNet.BabelFileMiddleware and WebMarkupMin? Seems like the latter one tries to change the response headers when they've already been sent. Does the issue persist if you disable WebMarkupMin?

#282560
Edited, Jun 27, 2022 18:52
Vote:
 

Thanks for the response Johan, after disabling this package everything worked. Then after renabling it and moving where it is registered in my startup.cs file is running with no issues. Much appreciated.

#282602
Jun 28, 2022 9:37
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.