Я пытаюсь загрузить файл во временную папку веб-задания Azure ...
public static string DownloadLogo(string url)
{
var fileName = $"{Path.GetTempPath()}logo.png";
using (var client = new WebClient())
{
client.DownloadFile(url, fileName);
}
return fileName;
}
Я получаю следующую ошибку:
Exception: System.Net.WebException: Could not find a part of the path 'D:\local\Temp\jobs\continuous\BillingProcessor\t2argeef.l1b\public\logo.png'. ---> System.Net.WebException: Could not find a part of the path 'D:\local\Temp\jobs\continuous\BillingProcessor\t2argeef.l1b\public\logo.png'. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\local\Temp\jobs\continuous\BillingProcessor\t2argeef.l1b\public\logo.png'.
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, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)
at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)
--- End of inner exception stack trace ---
at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)
at System.Net.FileWebRequest.GetResponseCallback(Object state)
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
В отдельной заметке:
- Я перешел в папку D: \ local \ Temp \ jobs \ непрерывный \ BillingProcessor \ t2argeef.l1b \, а общая папка отсутствует
- У меня этот код работает под другимРазвертывание webjob без проблем