Hello
I started a Core Web Application project (VS2017) with windows authentication on a domain.
When debugging, the app shows the correct user.
The code is in the Startup.cs
WindowsIdentity currentUser = WindowsIdentity.GetCurrent(); string name = currentUser.Name();
But when published to a local domain web server (WS 2016) it always shows the IIS APPPOOL/Namespace.
I googled the issue and tried applying all the options from other forums but was unable to resolve it.
The IIS manager Authentication is Windows auth Enabled, and all others disabled.
The UseAuthenticatedUser setting is set, and all other options that i picked up trying to resolve this.
The app is published under Default Web Site -> Add Application, not on the Default site. And it's on htttps but I doubt that would be the issue.
Tried
services.AddAuthentication(IISDefaults.AuthenticationScheme);
Nothing seems to be working.
When the ASP.Net Impersonation is Enabled (on the Default Web site, since i don't have that option in my web), then i get 500 Internal server error:
There is a problem with the resource you are looking for, and it cannot be displayed.
So the app runs without errors only if the ASP.Net Impersonation is disabled (win auth is enabled of course), but always as IIS APPPOOL.
Any help appreciated.