Create a folder, write a file to a shared folder on the server

My windows service creates a directory in the shared folder and I get the 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 am referencing a shared folder like: \\255.255.255.255\myfolder.uploads\

Any ideas on what should I do to write to this folder? This tab contains the Everyone and fullcontrol settings.

Update

Do I have to impersonate the user on another server in some way?

0


source to share


5 answers


There can be several things depending on the platform your server is running on. As a complete (and assuming a Windows based server) cross-validation, both share and folder have write permissions granted to the corresponding user account.

Simply granting share permissions may not work.



Hope it helps!

+1


source


To ensure security on shared folders on .net, you need to configure .net security using the ".NET Framework Configuration Tool" .



0


source


Try to start the service as your user.

0


source


I think you should explicitly start the service with the NetworkService account:
MSDN under the NetworkService account
It is different from the LocalSystem account you are using:
MSDN under the LocalSystem account

Hope it helps.

0


source


in C # Im using the following:

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

      

you should also look at the settings for the shared folders and the Security tab

0


source







All Articles