I have a web api controller, and I need to get the identity of the app pool which hosts the web application in IIS.
I have tried
string threadName = System.Threading.Thread.CurrentPrincipal.Identity.Name;
string username = this.User.Identity.Name;
But both are null. I want the name which runs the w3wp.exe such as IIS APPPOOL\DefaultAppPool or NETWORKSERVICE or whatever the app pool is configured to run as.
Tried both with authentication=none which is the default when creating a new Wep Api project in VS2013 and also tried with Forms auth, but no luck.