.net core 依赖注入IHttpContextAccessor
之前可以
builder.Services.AddHttpContextAccessor();
报错了
Microsoft.AspNetCore.Authorization.Policy.PolicyEvaluator': Unable to resolve service for type 'Microsoft.AspNetCore.Http.HttpContextAccessor' while attempting to activate
但是现在不行了
需要显示这么注入
builder.Services.AddTransient<IHttpContextAccessor,HttpContextAccessor>();
浙公网安备 33010602011771号