Fix: System.InvalidOperationException: Headers are read-only, response has already started
You set a header, status code, or content type after the body was already flushed. Set all headers before the first write, or guard with HttpResponse.HasStarted and OnStarting.