|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What permissions are needed for windows service to do C# impersonation when started under a user accI have a windows service that impersonates another account fine when it runs
under system account but fails to impersonate when run under a user account. What permissions must the windows service user account have inorder to do impersonation? the error i get is: System.ComponentModel.Win32Exception: Access is denied at myService.Service1.impersonatetest(String domain, String login, String password, String path) at myService.Service1.OnStart(String[] args) my login code is like this:
bool returnValue = LogonUser(userName, domainName, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref tokenHandle); Show quoteHide quote "Daniel" <softwareengineer98***@yahoo.com> wrote in message news:%23CK0%23375EHA.924@TK2MSFTNGP14.phx.gbl... > I have a windows service that impersonates another account fine when it runs > under system account but fails to impersonate when run under a user account. > What permissions must the windows service user account have inorder to do > impersonation? > > the error i get is: > > System.ComponentModel.Win32Exception: Access is denied > at myService.Service1.impersonatetest(String domain, String login, String > password, String path) > at myService.Service1.OnStart(String[] args) > > Daniel,
Try granting the user the service runs under the "Log on as a service" right. Also, I'd use LOGON32_LOGON_SERVICE instead of LOGON32_LOGON_INTERACTIVE. -- Show quoteHide quoteSincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx "Daniel" <softwareengineer98***@yahoo.com> wrote in message news:uHY1ub85EHA.824@TK2MSFTNGP11.phx.gbl... > my login code is like this: > bool returnValue = LogonUser(userName, domainName, password, > LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref tokenHandle); > > "Daniel" <softwareengineer98***@yahoo.com> wrote in message > news:%23CK0%23375EHA.924@TK2MSFTNGP14.phx.gbl... >> I have a windows service that impersonates another account fine when it > runs >> under system account but fails to impersonate when run under a user > account. >> What permissions must the windows service user account have inorder to do >> impersonation? >> >> the error i get is: >> >> System.ComponentModel.Win32Exception: Access is denied >> at myService.Service1.impersonatetest(String domain, String login, > String >> password, String path) >> at myService.Service1.OnStart(String[] args) >> >> > >
Other interesting topics
Accessing ActiveDirectory through LDAP with .NET
How to make this better and faster? How to screen scrap a non-browser based object? .NET competes with java-script Direction and suggestions needed compress specific data multiline toolbarbuttons Child control in non client area ? Form Event - Minimizing/Restoring Using .NET to import a delimited text file into an Access database |
|||||||||||||||||||||||