How to Set Windows Service and Web Service Access Permissions

Source: Internet
Author: User

If your software needs to access local files or folders and perform related operations, you may encounter some inexplicable errors when deploying it in Windows service2003, it can be run in other places. Once deployed, it cannot be run. When tracing and debugging are performed, the original permission issue is discovered.

 

Set Windows Service Access Permissions

If yourProgramThere is a Windows service and you need to access a local file, so you need to set the access permission for this file for users of the Windows service. In Windows, each service runs in the security context of a user account. You can find your service in "computer"-"management"-"service", right-click "properties", and switch to the "Logon" tab, you can see the account on which your service runs.

Generally, all services created by myself are the Authority \ LocalService account.

For example, SQL Server runs on a NetworkService account.

(For more information about Windows service user accounts, refer to this article.ArticleWindows Service User Account).

Now we can find the local folder that will be accessed in the Windows service. For example, if you operate c: \ to create a folder in the program, right-click the folder and choose Properties> Security"

It doesn't matter if there is no LocalService user above. Click "add"

Click "advanced"

Click "Search now"

See this user. Select it. Click OK to return to the first form.

Select this user and grant it permissions. You can grant corresponding permissions as needed.

OK, so that you can access the file through the windows service. No matter what operations you perform on the file, you will not have the permission.

 

Set WebService Access Permissions

If your program accesses local folders through web service, you also need to set permissions. The Web Service also has a user, which is the network service user by default.

The setting procedure is similar to the preceding one. Find the folder and find the user, for example, click "OK", and grant the corresponding operation permissions to the user.

After the settings are complete, you can access the service smoothly.

If you are in trouble, you can select the folder and grant all the permissions to its Everyone user. In this case, both Windows and web services can be accessed, however, this may cause security issues.

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.