david-acker / Trade-Tracker

Trade Tracking Solution in ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request with expired JWT causes InvalidOperationException in IdentityServiceExtensions

david-acker opened this issue · comments

Occurs when the authentication middleware attempts to set the response status code to 401 Unauthorized (for OnChallenge, in Line 65).

Exception Message:

Exception has occurred: CLR/System.InvalidOperationException
An exception of type 'System.InvalidOperationException' occurred in Microsoft.AspNetCore.Server.Kestrel.Core.dll but was not handled in user code: 'StatusCode cannot be set because the response has already started.'