I have a C# .NET service that runs as DOMAIN\username
on a windows server and it needs to access a network share \\share\export docs$\
.
If I'm logged into the machine (as DOMAIN\username
) I can see the share and I have even mapped it to X:
and tried to use that. I set the path in app.config (and restart the service) and if I use a path on C:
it works fine but if I try using \\share\export docs$\
or X:\
it can't see any of the files I need to access.
I have tried running the service as both a local user and as DOMAIN\username
Any ideas what I might be doing wrong?
EDIT: Stacktrace from log:
Could not find a part of the path 'X:\200909\11324709\coo.pdf'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Net.Mail.AttachmentBase.SetContentFromFile(String fileName, String mediaType)
at System.Net.Mail.Attachment..ctor(String fileName)