DI IHttpContextAccessor.HttpContext is null after upgrade to 2.2.0 #6080
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
feature-http-abstractions
DI IHttpContextAccessor.HttpContext is null after upgrade to 2.2.0
General
After upgrade aspnet core nuget packages from version 2.1.0 to 2.2.0 I've got issue IHttpContextAccessor.HttpContext unexpectedly became null during dependency injection.
I've investigated problem and found the cause of the problem was override
HttpContext.TraceIdentifier
in middleware. For 2.1.1 it was working well.Details
Middleware:
Resolving dependency in Startup.cs
To Reproduce
I've created sample app to reproduce this issue.
Start solution and make get http request on
http:\\localhost:5000/api/configuration
Source code with sample app: https://github.com/petttro/core2.2_HttpContext
Also attached source code zip file here
Sample.zip
The text was updated successfully, but these errors were encountered: