[英]Access to the path (under web application) is denied
為了簡化問題:
我在serverABC
( \\\\serverABC\\Equipment*
)上部署了一個名為Equipment
的Web應用程序
用戶將通過以下功能將文件復制到應用程序\\\\serverABC\\Equipment\\Folder1\\...\\File1.xls
的源路徑下:
System.IO.File.Copy ( strSourceFile, strDestFile, true );
strSourceFile ="\\\serverABC\Equipment\Folder1\...\File1.xls"
在properties -> Security
文件夾\\\\serverABC\\Equipment\\Folder1
,我為Network Service分配了讀取和寫入權限, Network Service是Web應用程序的應用程序池標識。
然后在使用網絡時出現此錯誤:
拒絕訪問路徑“ \\\\ serverABC \\ Equipment \\ Folder1 ... \\ File1.xls”。
我不知道這是怎么回事。
您不需要使用服務器名稱,因為它在同一服務器中。
由於要保存到應用程序中的目錄,因此請使用以下命令:
string path = Server.MapPath("Folder1");
然后將其與您的文件名連接起來,並在System.IO.File.Copy
使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.