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
Solved

.net windows service unable to access mapped network drives

Posted on 2008-06-21
3
1,059 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
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
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 simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

838 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