Problems with CreateDirectory at service mode

  • Thread starter Van Nguyen via DotNetMonster.com
  • Start date
V

Van Nguyen via DotNetMonster.com

My app run at 2 modes: Windows and Service. At Windows mode, my app works fine but at service mode, I can not use CreateDirectory command to create a new directory on server.
Ex:
Directory.CreateDirectory(@"\\ghpvn-linux1\ghp\20041205");

ghpvn-linux1: is the server name
ghp: is the shared directory
20041205: is the directory that I want to create

I receive error, starting "Could not find part of the path '\\ghpvn-linux1\ghp'."
I try to use both NetworkService account and LocalSystem account but still not success....
I have all the necessary permissions on shared directory of server
Can anybody help please?
Thanks,
Van Nguyen
 
O

Ollie

it soud slike it is either a permissions issue for the account under which
the service is running or the fact that a
services run under a differnent directory from the installation directory it
usually runs from the "\windows\system32"

HTH

Ollie Riches

Van Nguyen via DotNetMonster.com said:
My app run at 2 modes: Windows and Service. At Windows mode, my app works
fine but at service mode, I can not use CreateDirectory command to create a
new directory on server.
 
W

Willy Denoyette [MVP]

What do you mean with "I have all the necessary permissions on shared
directory of server"?
NetworkService and LocalService are local accounts, they use the "machine
account" for network access (only usable in an AD domain), how can they have
access right at a remote server?
You need to run your service with a domain account having access to the
remote server.

Willy.
 
V

Van Nguyen via DotNetMonster.com

First, thank for your answer.
I have new some problems. My server is linux server. So, with full control permissions on shared directory of linux server(drwxrwxrwx), my app only can create subdirectory with "nobody" account(default account for guest) on shared directory of linux server at service mode. In C#, how to access to shared directory of linux server with another acount(using username and password), such as samba account?
 
W

Willy Denoyette [MVP]

Van Nguyen via DotNetMonster.com said:
First, thank for your answer.
I have new some problems. My server is linux server. So, with full control
permissions on shared directory of linux server(drwxrwxrwx), my app only
can create subdirectory with "nobody" account(default account for guest)
on shared directory of linux server at service mode. In C#, how to access
to shared directory of linux server with another acount(using username and
password), such as samba account?

Use the credentials of your windows account to run your service.
Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top