Windows Service Remote Access sharing permission settings

Source: Internet
Author: User

Recently, a Windows Service was developed to synchronize files between shared directories.

Considering that, during the COPY process, if the network suddenly fails to be accessed, the file COPY is incomplete, We will discard the COPY method provided by. Net and use the XCOPY command under the doscommand.

Well ..... Just do it...

Verify, develop, and debug the XCOPY solution (two shared directories are created on your computer ).... Half a day, all done. It seems that things are going too smoothly .....

Since local debugging is okay, deploy it to the test environment. Okay... The problem arises.

An error occurred while synchronizing the two shared directories! Check the log. The XCOPY exit code ExitCode is 4, which means the path is incorrect.

Strange .... No reason ........ On the test server, the \ IP \ secure folder method is accessible and can be read and written normally.

Run the XCOPY command that failed synchronization in the CMD window. It succeeded ......

When you see this, you may also think that Windows Service has no permission to access and share.

Google ..... Google ....... Find the method for adding permissions.

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

The procedure is as follows:

1) First, find the user with the read and write permissions of the shared directory.

2) In the properties of Windows Service, select the "login" tab and under "this user", give a user with the permission to read and write the shared directory.

3) Click OK to restart the service.

Well, with an exciting heart, restart, re-Synchronize, and continue to fail ............. OH, Miss !!!!!!!!!!!!!!

Isn't that just adding a user to the service ...... Cheat paper .........

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

I have to say that Stackoverflow has a lot of scalpers...

USE the net use command to create and share a link

Usage: Net Use \ ServerIP \ login folder Password/USER: User

Don't talk nonsense. Hurry up and try .....

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

 

 

 

Related Article

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.