在azure云中删除blob时远程服务器返回错误:(404)Not Found

时间:2015-03-03 14:29:46

标签: c# azure cloud azure-storage

远程服务器返回错误:(404)Not Found ..如何解决此问题...

    public object Delete(string name)
    {
        dynamic deleted = true;

        try
        {
            CloudBlobClient blobClient = SMBS.GetBlobContainer();
            CloudBlobContainer blobContainer = blobClient.GetContainerReference("container1");

            CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(name);
            blockBlob.Delete();
        }
        catch (Exception ex)
        {
            deleted = false;
        }

        return deleted;
    }

1 个答案:

答案 0 :(得分:4)

实际上可能丢失了blob,或者您的请求可能未经过身份验证。请查看凭据是否正确。此外,您可以使用Azure Storage Client Library中的ICloudBlob.DeleteIfExists方法代替Delete方法。