Windows Service Access Remote share permissions settings

Source: Internet
Author: User

Recently, a Windows Service was developed to synchronize file synchronization between shared directories. consider that in the copy process, if the network suddenly can not access, causing the file copy is incomplete, decisively abandon the copy method of. Net, and use the xcopy command under DOS command.

Well..... Just do what you say.

xcopy program validation, development, debugging (two shared directories built from a PC) .... Half a day, all done. It seems that things are going too well .....

Since local debugging is no problem, deploy to a test environment. All right... Here's the problem.

Sync two shared directories, incredibly failed! View the log, Xcopy's exit code exitcode=4, which means the path is incorrect.

Strange.... There's no reason ... On the test server, it is accessible and can be read and written in a \\IP\\ShareFolder manner.

Run the xcopy command in the cmd window just after the failed synchronization, actually succeeded ...

As you can see, the Windows service does not have permission to access the share.

Google..... Google....... Find a way to add permissions.

Reference Links:
http://stackoverflow.com/questions/9905281/ How-to-access-to-a-shared-resource-with-a-windows-service-using-local-system-use

The steps are as follows:

1) First find a user with shared directory read and Write permissions

2) in the properties of Windows service, select the Login tab, under this user, to a user who has read and write access to the shared directory.

3) Click OK to restart the service.

All right, with an excited heart, restart, Resync, continue to fail ......

Not to say to the service to add a user on it ... Cheat paper .....

Continue Google ... Google.... Google..................

Have to say, StackOverflow above Daniel is more ...

Using the NET Use command to create a link to a share

Usage: Net use \\ServerIP\\ShareFolder password/user:user

No more nonsense, just try it ...

Command completed successfully .... With excitement, restart the service ..... Synchronization success!!!

Reprinted from Http://www.bkjia.com/C_jc/822288.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.