azure blob uploadfile错误请求

时间:2014-09-09 18:42:39

标签: azure-storage

您好我是azure的新手我正在尝试使用

将文件上传到azure容器
    static void UploadBlobFromFile(Uri blobEndpoint, string accountName, string accountKey)
    {
        // Create service client for credentialed access to the Blob service.
        CloudBlobClient blobClient =
            new CloudBlobClient(blobEndpoint,
                new  StorageCredentials(accountName, accountKey));

        // Get a reference to a container, which may or may not exist.
        CloudBlobContainer container = blobClient.GetContainerReference("StackOverflowAnalysis");

        // Create a new container, if it does not exist
        //container.CreateIfNotExist();

        // Get a reference to a blob, which may or may not exist.
        CloudBlockBlob blob = container.GetBlockBlobReference("QueryResults.csv");

        // Upload content to the blob, which will create the blob if it does not already exist.
        using (var filst = System.IO.File.OpenRead(@"c:\users\hmohamed\Downloads\QueryResults.csv"))
        { blob.UploadFromStream(filst); }
    }'

我收到错误请求400;我在mvc app中尝试这个我也尝试了它与控制台应用程序,我得到错误,该进程无法访问文件,因为它正被另一个进程使用。响应类似的帖子建议运行netstat命令来解决问题,但我不知道如何使用它以及提供什么参数;可以请一些人帮忙

1 个答案:

答案 0 :(得分:2)

容器名称中的所有字母必须为小写。所以,请使用" stackoverflowanalysis"作为您的容器名称。

有关命名的更多信息,请参阅Naming and Referencing Containers, Blobs, and Metadata