[visual-studio]Windows Azure 存储-找不到表

发布时间: 2014/3/1 3:08:26
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

我想实现 windows azure 表存储......,但我要'表找不到'

这里是我的连接字符串 (如何我 xml 在这里发表吗?)(抱歉的链接)

ServiceConfiguration.Cloud.cscfg: http://pastebin.com/F9tuckfT

ServiceConfiguration.Local.cscfg:

http://pastebin.com/XZHEvv6g

在这里有一个打印屏幕从我的 windows azure 门户

http://s20.postimage.org/nz1sxq7hp/print.png

代码 (抱歉......,更长的代码但是有三个页面......登录工程中,登录时转到 main.aspx 那电话 grid.aspx......在 grid.aspx 出现错误"找不到表"中所有此代码是重要的问题是...)http://pastebin.com/RnuvvqsM

我试过

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"];

        if (ht == null)
            GridView1.DataSource = context.SelectConc(ViewState["x"].ToString());
        else
            GridView1.DataSource = context.SelectConc(ht);

        GridView1.DataBind();
    }

但它也不工作

其他类似的错误是,当我试着在表中添加用户

public string addusr(string nome, string cidade, string cpf, string email, string telefone)
    {
        try
        {
            if (nome.Length == 0)
                return "f:Preencha o campo nome.";

            if (cidade.Length == 0)
                return "f:Preencha o campo cidade.";

            if (cpf.Length == 0)
                return "f:Preencha o campo cpf.";

            if (!Valida(cpf))
                return "f:CPF Invalido.";

            if (email.Length == 0)
                return "f:Preencha o campo email.";

            Regex rg = new Regex(@"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$");
            if (!rg.IsMatch(email))
            {
                return "f:Email Invalido";
            }

            List<UserEntity> lst = new List<UserEntity>();
            var _account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
            _account.CreateCloudTableClient().CreateTableIfNotExist("fiscal");
            var _context = new CRUDUserEntities(_account.TableEndpoint.ToString(), _account.Credentials);


            var account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
            account.CreateCloudTableClient().CreateTableIfNotExist("fiscal");
            var context = new CRUDUserEntities(account.TableEndpoint.ToString(), account.Credentials);
            UserClientEntity entity = new UserClientEntity() { nome = nome, cidade = cidade, cpf = cpf, email = email, telefone = telefone };
            context.ADDUSociate(entity);
            context.SaveChanges();
            return "k";
        }

我就此错误: f: 时出错处理此请求。 | 在 System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse() 在 System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest() 在 System.Data.Services.Client.DataServiceContext.SaveChanges (SaveChangesOptions 选项) 在 AzureTableLayer.CRUDUserEntities.ADDUSociate (UserClientEntity 实体) 在移动。Service1.addusr (字符串诺姆,字符串城市,字符串中央公积金、 电子邮件的字符串,字符串 telefone)

我相信这两个问题有关

编辑:我有调试,发现不会加载 StorageClient 框架的......我要这错误未能加载文件或程序集 Microsoft.WindowsAzure.StorageClient,版本 = 1.1.0.0,文化 = 中性,集 = 31bf3856ad364e35'

如何解决呢?

解决方法 1:

API 已被更改。您需要这样做:

var key = CloudConfigurationManager.GetSetting("Setting1");
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(key);
var client = storageAccount.CreateCloudTableClient();

CloudTable table = client.GetTableReference(ContactTableName);
table.CreateIfNotExists();
官方微信
官方QQ群
31647020