[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

.net windows service unable to access mapped network drives

Posted on 2008-06-21
3
Medium Priority
?
1,066 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 1400 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

649 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