2013-09-21 7 views
1

이미지 파일이 포함 된 Windows Azure Blob을 만들려고했습니다. 나는이 자습서를 따라 갔다 : http://www.nickharris.net/2012/11/how-to-upload-an-image-to-windows-azure-storage-using-mobile-services/http://www.windowsazure.com/en-us/develop/mobile/tutorials/upload-images-to-storage-dotnet/. 마지막으로 다음 코드는 이들의 병합을 나타냅니다. 'System.TypeLoadException'형식의Windows Azure Blob

예외 mscorlib.ni.dll에서 발생했지만 사용자 코드

추가 정보 처리되지 않은 : 마지막 줄에, 그러나 예외가 발생되는 지정한 유형 이름에 대한 바인딩이 이 아닙니다. (HRESULT 예외 : 0x80132005)

심지어 컨테이너가 테이블을 만들지 만 제대로 작동하지 않습니다.

private async void SendPicture() 
{ 
    StorageFile media = await StorageFile.GetFileFromPathAsync("fanny.jpg"); 

    if (media != null) 
    { 
     //add todo item to trigger insert operation which returns item.SAS 
     var todoItem = new Imagem() 
     { 
      ContainerName = "mypics", 
      ResourceName = "Fanny", 
      ImageUri = "uri" 
     }; 
     await imagemTable.InsertAsync(todoItem); 

     //Upload image direct to blob storage using SAS and the Storage Client library for Windows CTP 
     //Get a stream of the image just taken 
     using (var fileStream = await media.OpenStreamForReadAsync()) 
     { 
      //Our credential for the upload is our SAS token 
      StorageCredentials cred = new StorageCredentials(todoItem.SasQueryString); 
      var imageUri = new Uri(todoItem.SasQueryString); 

      // Instantiate a Blob store container based on the info in the returned item. 
      CloudBlobContainer container = new CloudBlobContainer(
        new Uri(string.Format("https://{0}/{1}", 
         imageUri.Host, todoItem.ContainerName)), cred); 

      // Upload the new image as a BLOB from the stream. 
      CloudBlockBlob blobFromSASCredential = 
        container.GetBlockBlobReference(todoItem.ResourceName); 
      await blobFromSASCredential.UploadFromStreamAsync(fileStream.AsInputStream()); 
     } 
    } 
} 
+0

코드에서 어떤 줄이 예외인지 알 수 있습니까? –

+0

켜기 : 기다리기 blobFromSASCredential.UploadFromStreamAsync (fileStream.AsInputStream()); 감사합니다. Gaurav Mantri. – igorvpcleao

답변

1

로드가 실패한 것을 확인하려면 Assembly Binding Log Viewer을 사용하십시오. 이 기사에서 언급했듯이 공용 언어 런타임에서 어셈블리를 찾지 못하면 일반적으로 응용 프로그램에 TypeLoadException으로 표시됩니다.

관련 문제