How can I give a windows service access on a remote machine in case of Workgroup?

女生的网名这么多〃 提交于 2019-12-06 12:10:55

问题


I'm working on a Windows Service that one of its tasks is archiving files on remote machine but I've a problem regarding access privileges in case of Workgroup.


回答1:


The simplest way is to mirror the username and password on both machines, creating the same account on both machines, then run your service under that account. As you're in a workgroup and not a domain the remote login will work, but once you're in a domain that no longer works.

You cannot use any of the built in service accounts (Network Service, Local Service, Local System for this)




回答2:


You can run it under user account that has access privileges on remote machine.

Or you can use impersonation when accessing remote machine. For impersonation you will need username and password that has access to remote machine. Look here for some code on impersonating in .net http://blogs.msdn.com/shawnfa/archive/2005/03/22/400749.aspx



来源:https://stackoverflow.com/questions/550742/how-can-i-give-a-windows-service-access-on-a-remote-machine-in-case-of-workgroup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!