Since this implementation relies on the System.DirectoryServices
and System.DirectoryServices.AccountManagement
libraries, the ASP.NET Core project must target .NET Framework
rather than .NET Core
or .NET Standard
.
Add references to
System.DirectoryServices
andSystem.DirectoryServices.AccountManagement
in the ASP.NET Core project
<PropertyGroup>
<TargetFramework>net471</TargetFramework>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
Also, Windows Authentication must be used:
{
"iisSettings": {
"windowsAuthentication": true,
"anonymouseAuthentication": false
}
}