Określony kontener nie istnieje
Utknąłem z tym błędemThe specified container does not exist.
pozwól mi wyjaśnić,
CloudBlobClient blobStorage = GetBlobStorage("upload");
CloudBlockBlob blob = BlobPropertySetting(blobStorage, Guid.NewGuid().ToString().ToLower() + Path.GetExtension(file.FileName));
blob.UploadFromStream(file.InputStream);
public static CloudBlobClient GetBlobStorage(string cloudBlobContainserName)
{
CloudBlobClient blobStorage;
try
{
var storageAccount = CloudStorageAccount.FromConfigurationSetting("StorageConnectionString");
blobStorage = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobStorage.GetContainerReference(cloudBlobContainserName);
container.CreateIfNotExist();
var permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);
}
catch (Exception ex)
{
Logger.LogError(Log4NetLogger.Category.Exception, "Error in : BlobHandler.GetBlobStorage :>> Exception message: " + ex.Message);
throw;
}
return blobStorage;
}
public static CloudBlockBlob BlobPropertySetting(CloudBlobClient cloudBlobClientReferenceName, string blobContentName)
{
CloudBlockBlob blob = cloudBlobClientReferenceName.GetBlockBlobReference(blobContentName);
return blob;
}
i mójStorageConnectionString
jest
<Setting name="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=duw;AccountKey=bla bla" />
kontener „upload” i istnieje konto magazynu „duw”.
wykonywanieblob.UploadFromStream(file.InputStream);
instrukcja powoduje błąd.
Ślad stosu :
w Microsoft.WindowsAzure.StorageClient.Tasks.Task1.get_Result() at Microsoft.WindowsAzure.StorageClient.Tasks.Task
1.ExecuteAndWait () w Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImpl (Func`1 impl) w Microsoft.WindowsAzure.StorageClient.CloudBlob.UploadFromStream (Źródło strumienia, opcje BlobRequestOptions) w Microsoft.WindowsAzure.StorageClient.CloudBlob.UploadFromStream (Stream source) w DAL.Handlers.BlobHandler.CreateAd (plik HttpPostedFileBase, model reklamy) w D: Serwer serwera trunk Du Server DAL handlers BlobHandler.cs: linia 151
wyjątek wewnętrzny:
{"The remote server returned an error: (404) Not Found."}
czy jakiekolwiek ciało może mi pomóc rozwiązać ten problem.