I have a COM component which I call from a .NET Windows service which runs as Local System. This service calls a COM component which then runs under the SYSTEM account. While I am debugging, I am trying to test running the COM component under different user accounts. I am using Impersonation to do this and I have used the same code for doing this successfully for other things. However, trying to do the same thing to load the COM component under a different account isn't working. It is still loading as SYSTEM account.
Is there a different procedure for doing this with COM components being loaded with COM Interop?
The code is just:
var identity = Impersonate.GetIdentity(Username, Domain, Password);
identity.Impersonate();
MyLib.Component com = new MyLib.Component();