私のアプリケーションでは、ドキュメントをAzureBLOBストレージにアップロードしようとしています。コードは次のとおりです。
// Namespaces for Azure
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
public ActionResult GetPdf(HttpPostedFileBase document)
{
int pdfocument = Request.ContentLength;
var doctype=Request.ContentType;
byte[] pdf = new byte[pdfocument];
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("Setting1"));
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("containername");
container.CreateIfNotExists();
var permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Blob;
container.SetPermissions(permissions);
string uniqueBlobName = "blobname";
CloudBlockBlob blob = container.GetBlockBlobReference(uniqueBlobName);
blob.Properties.ContentType = doctype;
blob.UploadByteArray(pdf);
}
アプリケーションをビルドすると、でエラーが発生しcontainer.CreateIfNotExists()
ます。エラーは次のとおりです。
「Microsoft.WindowsAzure.StorageClient.CloudBlobContainer」には「CreateIfNotExists」の定義が含まれておらず、「Microsoft.WindowsAzure.StorageClient.CloudBlobContainer」タイプの最初の引数を受け入れる拡張メソッド「CreateIfNotExists」が見つかりませんでした(usingディレクティブがありませんか?またはアセンブリ参照?)'。
そのエラーに対してどの名前空間を追加できますか?