C# 使用Web.Net.WebClient下载文件
我是c语言下载文件和目录的初学者,使用C# 使用Web.Net.WebClient下载文件,c#,file,download,webclient,C#,File,Download,Webclient,我是c语言下载文件和目录的初学者,使用Web.Net.WebClient。 我尝试使用此代码段下载文件: Upload.Models.FichierModels fichier = new FichierModels(); WebClient client = new WebClient(); try { client.DownloadFile(new Uri(fichier.GetFichierUrlById(_id)), "fichier"); } catch { } 但我
Web.Net.WebClient
。
我尝试使用此代码段下载文件:
Upload.Models.FichierModels fichier = new FichierModels();
WebClient client = new WebClient();
try
{
client.DownloadFile(new Uri(fichier.GetFichierUrlById(_id)), "fichier");
}
catch { }
但我有一个例外:
访问路径“C:\\Program Files(x86)\\IIS Express\\
文件“”被拒绝
这个异常的原因是什么?如何修复我的代码?您必须从网站的应用程序池中找出它运行的身份 默认情况下,这是应用程序池标识 然后你必须授予它正确的权限 具体如下: 解决方案
希望对您有所帮助。我找不到GFI MailArchiver虚拟目录。iselected sites-->默认网站如pic中所示