Azure CloudFile - “The specifed resource name contains invalid characters.”

女生的网名这么多〃 提交于 2020-12-05 10:31:45

问题


I'm trying to download a file from Azure File Storage to a local file and get this exception:

"The specifed resource name contains invalid characters."

Here's the code:

if (_cloudFileShare.Exists())
{
      CloudFileDirectory rootDir = _cloudFileShare.GetRootDirectoryReference();    
      CloudFileDirectory tempDir = rootDir.GetDirectoryReference("temp");
      if (tempDir.Exists())
      {
        var file = tempDir.GetFileReference(saveFrom);
        file.DownloadToFile(saveTo, FileMode.Open);// OFFENDING LINE
      }
 }

The saveTo argument is a string and the value is something like this:

"C:\Users\Me\AppData\Local\Temp\tmpF2AD.tmp"

The saveFrom argument is something like this:

https://storageaccount.file.core.windows.net:443/fileshare/temp/tmpA2DA.tmp

I'm creating the argument using this function:

var saveTo = Path.GetTempFileName();

What am I doing wrong? I don't have much experience with Azure.

来源:https://stackoverflow.com/questions/44849971/azure-cloudfile-the-specifed-resource-name-contains-invalid-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!