为什么我的log4net没有在Impersonate之后登录,在Undo之后开始日志记录
testDebug 6不是日志。
我能做些什么?
logger.Debug("testDebug 5");
// The token that is passed to the following constructor must
// be a primary token in order to use it for impersonation.
WindowsIdentity newId = new WindowsIdentity(dupeTokenHandle);
WindowsImpersonationContext impersonatedUser = newId.Impersonate();
logger.Debug("testDebug 6");
// Check the identity.
// Console.WriteLine("After impersonation: "
// + WindowsIdentity.GetCurrent().Name);
if (Config.DebugMode().Trim().ToUpper() == "ON")
logger.Debug("After impersonation: " + WindowsIdentity.GetCurrent().Name);
//////// Put your code here ////////
ReceiveEmail();
///////////////////////////////////
// Stop impersonating the user.
impersonatedUser.Undo();
logger.Debug("testDebug 7");发布于 2016-10-13 04:26:09
最有可能的是,模拟用户没有对日志文件的写/追加访问权限。
https://stackoverflow.com/questions/40012051
复制相似问题