I developed a windows service to write PDF file in a directory. The service has no problem writing files to local drives. But when it tries to write to network mapped drives, it fails and writes the file in the application directory.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here are some experiences I had while creating the same service as you did (reading and saving PDF on a network drive). I had 2 drives: The first without the need of authentication and the second where you had to authenticate.
Common faults with mapped network drives
UNC Path vs Drive Letter: Drive letter’s don’t work, you have to specify your path using the UNC notation. (e.g. \\10.17.194.1\RemoteDir\)
Authentication: If the network drive needs you to authenticate, the only way I found was to create the authentication user on the machine running the service. If you need to authenticate as “RemoteUser” with “RemotePassword” to access the network drive, you should create a RemoteUser/RemotePassword account on the server and let the service run as this user.
If you don’t have the rights to access the directory you’ll be getting a exception telling you it could not find the directory/file or rather that it does not exist.
Service can’t establish connection by itself: Also, it is mandatory to access the network drive at least once manually from the explorer so you can browse it. My service was unable to establish a connection to the network drive by itself, it had to be established in the explorer before.
I hope any of this points help you.