tags:

views:

486

answers:

5

Hi,

My windows service is creating a directory on a shared folder, and I am getting a error:

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path,DirectorySecurity dirSecurity)
at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity)
at System.IO.Directory.CreateDirectory(String path)     at

I referencing the shared folder like: \\255.255.255.255\myfolder.uploads\

Any ideas on what I have to do to be able to write to this folder? The share has Everyone and fullcontrol setup on it.

Updates

Do I have to impersonate a user on the other server somehow?

A: 

For security in shared folders on .net you need to configure the .net security with ".net Framework Configuration Tool".

FerranB
+1  A: 

Hey Blank,

This could be a couple of things depending upon the platform your server runs. As a complete (and assuming a windows based server) guess cross check both the share AND the folder have write permissions given to the appropriate user account.

Just providing permissions on the share only may not work.

Hope that helps!

Matt Woodward
A: 

Try running the service under your user.

Igal Serban
A: 

I think you should explicitly run the service with the NetworkService Account:
MSDN on NetworkService Account
It is different from the LocalSystem account you are using:
MSDN on LocalSystem Account

Hope it helps.

Turro
A: 

in C# Im using the following :

string DIR_CONTA = "\\\\192.168.0.X\\folder\\subfolder";

you must also review shared folders options, and Security tabs

Angel Escobedo