我正试图从windows azure存储中获取daa但是我找不到表。我已经看到了其他答案,但没有任何作用......
我试过这个:
private void popula()
{
var account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
account.CreateCloudTableClient().CreateTableIfNotExist("fiscal");
var context = new CRUDManifestacoesEntities(account.TableEndpoint.ToString(), account.Credentials);
Hashtable ht = (Hashtable)ViewState["filtro"];
var teste = ViewState["x"].ToString();
if (ht == null)
GridView1.DataSource = context.SelectConc(teste);
else
GridView1.DataSource = context.SelectConc(ht);
}
public List<ManifestacaoGrid> SelectConc(string conc)
{
conc = Crypto.DecryptString(conc);
IQueryable<ManifestacaoEntity> results = null;
if (!conc.Equals("dfg"))
results = from c in ManifestacaoEntities where c.concessionaria == conc select c;
else
results = from c in ManifestacaoEntities select c;
var query = results.AsTableServiceQuery<ManifestacaoEntity>();
var queryResults = query.Execute();
List<ManifestacaoGrid> al = new List<ManifestacaoGrid>();
foreach (ManifestacaoEntity mf in queryResults)
{
.......
}
我收到了这个错误:
TableNotFound
指定的表不存在。 请求ID:285f6ef7-b1ce-4c21-9406-3e9f6a58755b 时间:2014-01-15T14:30:55.7989535Z
编辑:我打印'_account'以查看凭据是否正确: var credencial =“具有敏感数据的连接字符串:”+ account.ToString(true); 并且AccountName和AccountKey是正确的......但是如何知道请求的表是否正确? 存储帐户中是否需要secundary密钥?
答案 0 :(得分:0)
我确实发现了这个问题。我写了
public IQueryable<UserEntity> UserEntities
{
get
{
return this.CreateQuery<UserEntity>("tableName");
}
}
而不是:
public IQueryable<UserEntity> UserEntities
{
get
{
return this.CreateQuery<UserEntity>("UserEntities");
}
}