I have a windows service and I'm using a remote connection to access a folder and this folder has a password and a user that it is already specified down here in the code but it doesn't seem to access anyway I've already tried to do this locally and it works but when I do it remotely just doesn't work. any help would be great thank you!
Public Class Service1
Dim cred As New NetworkCredential("Administrator", "*P4ssW0rD")
Private Sub SchedularCallback(e As Object)
'Metodo Procesa Archivos tipo boleano
Dim di As DirectoryInfo = New DirectoryInfo("\\132.147.161.83\SisInt\courts\agreement\J92016SEM2")
For Each fi In di.GetFiles()
'seleccionamos los archivos con las extensiones de Word
If fi.Extension.ToUpper = ".DOC" Or fi.Extension.ToUpper = ".DOCX" Then
ListaArchivos.Add(fi.FullName)
ListaNombres.Add((fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length)))
End If
Next
Windows Services operate in the security context of the account that's specified in the Services Control Panel, so you would need to change it there.
By default, the service only has access to local resources which is why you can't access anything outside the local machine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.