MSDN > Home page del forum > Windows Azure > Create tables failing or ....
Formula una domandaFormula una domanda
 

Con rispostaCreate tables failing or ....

  • giovedì 2 luglio 2009 6.49Jonesie Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    My site was working fine and now it cant create tables - at least I think so.

    In my worker role global startup I have calls to CreateTableFromModel but when I try to use a table I get an error:  An error occurred while processing this request.

    Sorry, this is a little vauge.

    Has anything changed lately?


    Peter G Jones, New Zealand

Risposte

  • domenica 5 luglio 2009 20.35Jonesie Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con risposta
    Hi

    I created a powershell script to create the table in Azure and this was also failing.  After much stuffing around I found that the script worked when Fidler was NOT running !  Grrrrrr !

    So I have removed the code from the web role that creates the tables at runtime and I just use the script to create the tables during deployment.  I'd like to be able to fix this properly but we are out of time and budget for this prototype.

    Cheers
    Peter G Jones, New Zealand
    • Contrassegnato come rispostaJonesie domenica 5 luglio 2009 20.36
    •  

Tutte le risposte

  • giovedì 2 luglio 2009 7.17Yi-Lun LuoMSFT, ModeratoreMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Hello, can you provide more information? Are you creating the tables in local development storage or cloud storage? Development storage doesn't support creating tables dynamically. You'll have to use devtablegen to pre-generate the tables. If you're working with the cloud storage, did you get additional information? Like the status code, and detailed error message. you can use Fiddler/Network Monitor to trace the http traffic to get more details. Creating table may fail if the table with the same name already exists, the name contains illegle characters, authentication problem, and so on. We need more information to go further.
    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
  • giovedì 2 luglio 2009 21.54Jonesie Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Contiene codice
    Yeah sorry, that was terribly vauge.

    Dev storage works fine.  I create the tables with a CMD file.  My code also had calls to CreateTableFromModel() and this seemed to work fine in the cloud before this week.  How I dont have any existing tables in the cloud and I cant create them.

    I have connected my dev fabric instance to cloud storage so I can see what is going on and havent yet tried fidler.  I'm using the following code to create the tables:

          if(!ts.DoesTableExist(CloudServiceRequestTable.TableName))
            TableStorage.CreateTablesFromModel(typeof(CloudServiceRequest), _account);
          if (!ts.DoesTableExist(CloudAlertTable.TableName))
            TableStorage.CreateTablesFromModel(typeof(CloudAlert), _account);
    
    I dont get any exceptions.

    Using Azure Storage Explorer from CodePlex I cant see the tables after this code runs and if I check the tables again they are not there:

          // 1 or more tables dont exist at all so no point in doing anything else
          if (!ts.DoesTableExist(CloudServiceRequestTable.TableName))
            return false;
          if (!ts.DoesTableExist(CloudAlertTable.TableName))
            return false;
    

    Oh.  I just ran fidler and tried again.  I can now see this in the response:

    100
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code>ResourceNotFound</code>
      <message xml:lang="en-US"><strong>The specified resource does not exist</strong>.</message>
    </error>
    0
    

    The request is to: blahblah.table.core.windows.net and the header has GET /Tables('CloudServiceRequests') HTTP/1.1

    The storage account wasn't changed by us.

    Any ideas?

    Thanks







    Peter G Jones, New Zealand
  • venerdì 3 luglio 2009 11.19Jai HaridasMSFTMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Can you provide us with the request id (the value of the response header - x-ms-request-id) and the date in the response? That will help us investigate.

    The above "ResourceNotFound" is expected for the GET request if the table does not exist. You may need to debug CreateTablesFromModel and see why a POST request was not sent... so you should have seen POST for /Tables uri. If it was sent, can you give us the request id and approx date for such POST requests that create tables?

    The reason why this works against devstorage is because the tables are created outside the app and CreateTablesFromModel is kind of no-op in the current version of the devstorage.

    Thanks, Jai
  • domenica 5 luglio 2009 20.35Jonesie Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con risposta
    Hi

    I created a powershell script to create the table in Azure and this was also failing.  After much stuffing around I found that the script worked when Fidler was NOT running !  Grrrrrr !

    So I have removed the code from the web role that creates the tables at runtime and I just use the script to create the tables during deployment.  I'd like to be able to fix this properly but we are out of time and budget for this prototype.

    Cheers
    Peter G Jones, New Zealand
    • Contrassegnato come rispostaJonesie domenica 5 luglio 2009 20.36
    •  
  • domenica 5 luglio 2009 21.24Neil Mackenzie Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     

    The best practices for tables section of the Windows Azure Tables white paper states:


    -- Applications should separate table creation logic from the main business logic.  For example, consider applications attempting to create a table before each entity insert, and relying on “Table already exists” exceptions being sent back if the table is already present.  This results in a lot of unnecessary transactions to the store, which can accumulate in transaction costs for the application, once a billing model is in place.

    -- We recommend that the table creation logic be executed, as a separate script when first setting up a service, when a role starts up, or when "TableNotFound" error is returned with HTTP Status code of 404.  Table creation logic should not rely on “Table already exists” exception but instead it should retrieve the table before it tries to create it.