Solved

.net windows service unable to access mapped network drives

Posted on 2008-06-21
3
1,062 Views
Last Modified: 2013-11-06
I have a windows service in C# ( not ASP .NET) which should read files from local and remote drives.
Local drives works fine but when i do a directory.Exists() on remote drive, it says filepath not found.
It was mentioned that we cannot use drive letters in windows service. I tried UNC paths also but no luck.
Both the machines are under the same domain, the remote directory has full access to everybody.
I could read the UNC path using windows application though. Tried running the windows service both under local system and network service. Any help is appreciated!
0
Comment
Question by:vizagboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:Marcjev
ID: 21838269
You should use a real account. Both the local account nor the network service account have sufficient rights to access the other computers share. The local system has a name who says it all. The network service account has very limmited access rights and is intended for your computer to present itself to the network. (Like a default asp.net app listening only...)
0
 
LVL 5

Accepted Solution

by:
JuckMan earned 350 total points
ID: 21839639

the reason you are unable to use the drive lettes is, drive letter mapping is for the current login user only. Service run under a different security context and has no way of understanding it. Think of it another way, you can run a service without login to your computer. Mapped letters available once a user login.

Use the service properties and in the logon tab select a domain use account, which has rights to access both your local and remote drives.  Also note that this account needs to have "Log on as service" privilege, this will be granted automatically when you type in the user in the "logon" tab in service properties.

If your orgainization is paranoid with security issues, then you need to consider the following. Create a domain account, and when it is created set it as "deny login as local user" privilege. In this way it will be make it difficult for any body to hack or impersonate the service to do something else.

hope this helps
0
 

Author Closing Comment

by:vizagboy
ID: 31469432
Thanks a lot. Changed the service properties to run the service as a domain user who has access to both the accounts and it worked like a charm. Thank you for the help!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question