none
Cant seem to see the issue RRS feed

  • Question

  • Hi,

    I have an error on debugging.

    System.FormatException: 'No valid combination of account information found.'

    here is my .cs code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.Azure;
    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Blob;

    namespace Blobs
    {
        class Program
        {
            static void Main(string[] args)
            {
                
                string storageconnection =System.Configuration.ConfigurationManager.AppSettings.Get("StorageConnectionString");
                 CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageconnection);

                CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

                CloudBlobContainer container = blobClient.GetContainerReference("objective2");

                container.CreateIfNotExists();
                 
                CloudBlockBlob blockBlob = container.GetBlockBlobReference("examobjectives");

                using (var filestream = System.IO.File.OpenRead(@"C:\Users\EBumi2\Downloads\ccnacloud.pdf"))

                {
                    blockBlob.UploadFromStream(filestream);
                }

                Console.ReadKey();
            }
        }
    }

    and here is my .config file

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup>
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
        </startup>

      <appSettings>
        <add key="StorageConnectionString" value="DefaultEndpointProtocol=https;AccountName=az532store; AccountKey=MT8uYE4OhliXePcyAti7t8njsZQnaFI6tbOMqGjqZPVl0xqKprMpny51FONMaxKYYZL6U1SfpLXCUHxP2pSVvw=="></add>
        
      </appSettings>
     
     
     
    </configuration>

    Please do help
    Thursday, December 28, 2017 8:30 AM

Answers

  • It seems to me that your connection string is not correct. Take a look at connectionstrings.com and their examples of Windows Azure Storage Client connection strings. You'll notice that it says "DefaultEndpointsProtocol" and not as in your case "DefaultEndpointProtocol".

    wizend

    • Marked as answer by hsnanua Thursday, December 28, 2017 11:41 AM
    Thursday, December 28, 2017 9:50 AM

All replies

  • I'm not an expert in this, but it looks like your account information in the appSettings is not correct.

    Details on the connection string can be found here, where it also mentions checking your connection string against your Azure portal (Settings/Access keys section)

    Thursday, December 28, 2017 8:57 AM
  • It seems to me that your connection string is not correct. Take a look at connectionstrings.com and their examples of Windows Azure Storage Client connection strings. You'll notice that it says "DefaultEndpointsProtocol" and not as in your case "DefaultEndpointProtocol".

    wizend

    • Marked as answer by hsnanua Thursday, December 28, 2017 11:41 AM
    Thursday, December 28, 2017 9:50 AM
  • Perfect!
    Thursday, December 28, 2017 11:41 AM