I have a WCF web service with different sections that need to run under different users.
One of them is clustering, which is implemented using the Interop.MSClusLib API.
I’m trying to apply impersonation with a specified user, but it’s completely getting ignored.
using (new Impersonator(_impersonation.User, _impersonation.Domain, _impersonation.Password))
{
var cluster = new Cluster();
cluster.Open(clusterName);
}
(Impersonator: http://www.codeproject.com/KB/cs/zetaimpersonator.aspx)
WindowsIdentity.GetCurrent() gets the user that I’m impersonating, but I still get:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at MSClusterLib.ClusterClass.Open(String bstrClusterName)
When I set the application pool identity to that user, it does work but that’s not what I want to be doing.
Is there any way that this can get fixed?
Thx!
Got the explanation from a colleague:
There are 2 levels of authentication in applications: process and thread.
Impersionation only sets the thread identity, while the Cluster API seems to use the process identity.