none
How to test the TableStorage locally using DevFabric?

    Question

  •  Hi,

       I can connect to my TableStorage in Azure Cloud...But i could not test my app locally using "useDevelopmentStorage=true"...Does anybody know how to get a valid CreateCloudTableClient object for my local devfabric?


    Monday, March 05, 2012 6:44 PM

Answers

  • Hi - thanks for the question.  You can read more about using development storage here: http://msdn.microsoft.com/en-us/library/gg432983.aspx

    Specifically, to create a valid CloudTableClient object that uses developer storage, you should be able to use this code (please note, the storage key below is public information because it's always the same for developer storage - never share your cloud storage key):

    string accountname = "devstoreaccount1";
    string accountkey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";
    string tableServiceAddress = "http://127.0.0.1:10002/devstoreaccount1";
    StorageCredentials creds = new StorageCredentialsAccountAndKey(accountname, accountkey);
    CloudTableClient tableClient = new CloudTableClient(tableServiceAddress, creds);


    -Jeff

    Monday, March 05, 2012 7:00 PM
  • Hello.

    What do you mean when saying "i could not test my app locally"? Maybe your Table service don't started? Check Storage Emulator.

    Tuesday, March 06, 2012 3:06 AM

All replies

  • Hi - thanks for the question.  You can read more about using development storage here: http://msdn.microsoft.com/en-us/library/gg432983.aspx

    Specifically, to create a valid CloudTableClient object that uses developer storage, you should be able to use this code (please note, the storage key below is public information because it's always the same for developer storage - never share your cloud storage key):

    string accountname = "devstoreaccount1";
    string accountkey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";
    string tableServiceAddress = "http://127.0.0.1:10002/devstoreaccount1";
    StorageCredentials creds = new StorageCredentialsAccountAndKey(accountname, accountkey);
    CloudTableClient tableClient = new CloudTableClient(tableServiceAddress, creds);


    -Jeff

    Monday, March 05, 2012 7:00 PM
  • Hello.

    What do you mean when saying "i could not test my app locally"? Maybe your Table service don't started? Check Storage Emulator.

    Tuesday, March 06, 2012 3:06 AM
  • Hi Jeff,

        Thanks for the reply...Do we need to install SQLserver in order to use development storage?



    Tuesday, March 06, 2012 7:59 AM
  • Hi Alex,

                Storage emulator is started, But i dont have sql server installed on my machine will it cause any problem?...i restart the storage emulator...while initializing the DSinit it show me the following error, 

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Added reservation for http://127.0.0.1:10000/ in user account AD\Administrator.
    Added reservation for http://127.0.0.1:10001/ in user account AD\Administrator.
    Added reservation for http://127.0.0.1:10002/ in user account AD\Administrator.


    Creating database DevelopmentStorageDb20110816...
    Cannot create database 'DevelopmentStorageDb20110816' : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


    One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again. These errors can occur if SQL Server was installed by someone other than the current user. Please refer to http://go.microsoft.com/fwlink/?LinkID=205140 for more details.

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



    Tuesday, March 06, 2012 8:03 AM
  • Ya its working....

    Thank You alex and jeff...

    The problem was i have been trying with out installing the SQL server  in my Machine :(....

    Tuesday, March 06, 2012 11:25 AM
  • Hello.

    It's good that you solved your problem. Yes, as you already know, SQL Server (at least Express) is essential for Storage Emulator.

    Tuesday, March 06, 2012 2:22 PM
  • Good to hear - yes, you do need to have SQL Express or SQL Server installed, as this is where Storage Emulator will store its data.  Glad you've got it working now!

    -Jeff

    Tuesday, March 06, 2012 6:11 PM
  • After this i think you need to set storage emulator to use your local SQL instance.

    this is a one time deal unless to you change your SQL specifications

    Thursday, March 15, 2012 10:35 AM
  • @Ansari: UseDevelopmentStorage=true make use of local SQL instance...we dont need any external settings....


    Thursday, March 15, 2012 10:47 AM
  • Noted, Thanks
    Thursday, March 15, 2012 11:52 AM