Upgraded C# MVC project EF 4.7.2 to .net Core 8.0, on build my solution, I got the below error.
'OperationContext' does not contain a definition for 'ServiceSecurityContext' and no accessible extension method 'ServiceSecurityContext' accepting a first argument of type 'OperationContext' could be found (are you missing a using directive or an assembly reference?)
using System.Security.Principal;
using System.ServiceModel;
if (OperationContext.Current != null)
{
if (!string.IsNullOrEmpty(OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name))
{
return OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name;
}
if (!string.IsNullOrEmpty(OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name))
{
return OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name;
}
}
I tried to install System.ServiceModel.Primitive and it didn't work.