简体   繁体   中英

How to copy file from network path to local location with WCF Webservice?

My webservice is attempting to do a file copy from a network path (\\myserver\\data\\file.dat) to a local location (C:\\temp\\file.dat).

File.Copy(NetworkPath, LocalPath, true);

However I am getting the following exception when I test my code using WCF Test Client.

Access to the path '\\myserver\\data\\file.dat' is denied.

How to resolve this error?

If you're using IIS, you need to make sure that the user which is set up for the application pool that your WCF service is using has proper access rights to the folder (write access in this case).

You may need to replace the default user with another one that you should create for that purpose as the default user has limited access to file system.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM