Windows service cannot copy file sharing

I have a windows service installed to copy files from a local directory to a samba share.

The service connects through the UNC path to the server (i.e. \ remoteserver \ shareddir).

I registered as the user the service is running under and was able to copy files and create files on the samba share using the UNC path.

However, when I start the service, I get io exceptions that offer a login error. I started the process monitor in this field, watching the service, and I see how it finds the UNC path, but receives a login error when trying to write to the shared resource.

This uses the simple vanilla .net System.IO.File.Copy code.

I do not understand the error, because when I log in as the same user, I can copy and create files on a shared resource.

Any ideas?

Edit: exception text

Error in the main processing loop (DoWork ()): Login error: unknown username or invalid password.

System.Exception error: MyService.ProcessExportTransferfileDirectories error and values: D: \ Export, \ RemoteServer \ intray, D: \ Export \ Archive ---> System.IO.IOException: Login failed: Unknown username or invalid password.

System.IO.__ Error.WinIOError(Int32 errorCode, String maybeFullPath) System.IO.__ .WinIOError() System.IO.File.Move(String sourceFileName, String destFileName)
MyService.Consumer.BusinessLogic.WmsFacade.MoveAndArchiveFile(String sourceFolder, String targetFolder, String archiveFolder, String rootFolder, LogCategory logCategory, LogCounter logCounter) --- MyService.Consumer.BusinessLogic.WmsFacade.MoveAndArchiveFile(String sourceFolder, String targetFolder, String archiveFolder, String rootFolder, LogCategory logCategory, LogCounter logCounter) MyService.Consumer.BusinessLogic.WmsFacade.ProcessExportTransfer(IDictionary`2 fileDirectories) MyService.Core.TimedWorkerProvider.DoWork()

+5
4

- , samba, , .

- , / Windows, , : (

+4

, , .

net net use. :

System.Diagnostics.Process.Start("net", "use h: \remoteserver\shareddir /User:domian\me password")

.

+2

. :

Process Name is "your_process.exe" AND Operation is "CreateFile"

, .

+1

, , , . - Oded 1 .

, " " ​​ ?

0

All Articles