I have a dotnet core Web API running on IIS. I also have a server side Blazor app running on IIS on the same server.
The API is running under its own app pool as service account. That services account has access to the API.
On a page in the Blazor app I am making a call to the API like so:
var client = new RestClient("https://myApi.mydomain/v1")
{
Authenticator = new NtlmAuthenticator()
};
var request = new RestRequest("licenses", DataFormat.Json);
var response = await client.ExecuteAsync<List<Licenses>>(request);
return response.Data;
But on the API side I am getting a 401 0 0 20 followed by a 401 1 3221225581 0. I looked up the code 3221225581 after converting to hex and it was NULL SID.
On IIS I have Anonymous access disabled and Windows Auth Enabled. I am controlling access on the API Controllers with the [Authorize] attribute.
The only way I can get this to work is if I enable Anonymous Access and remove the [Authorize] attribute.
Another thing worth noting is that another application written in .NET 4.x full framework, using the same HttpClient calls, can successfully hit the API.