visual studio - Windows Azure Error C#
本文关键字:Error Azure Windows studio visual | 更新日期: 2023-09-27 17:54:40
我得到这个错误:
f: error_processar esta solicita_data_name = 0。| emSystem.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse ()新兴市场System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest ()新兴市场System.Data.Services.Client.DataServiceContext.SaveChanges (SaveChangesOptions选项)新兴市场AzureTableLayer.CRUDUserEntities。ADDUSociate (UserClientEntity实体)na用户' ' WindowsAzureProject1 ' AzureTableLayer ' CRUDUserEntities.cs: linha43 em mobile.Service1。addusr(字符串名称,字符串名称,字符串名称)字符串email,字符串电话)na 'Service1.svc.cs:linha 124
方法是:
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);
UserClientEntity entity = new UserClientEntity() { nome = nome, cidade = cidade, cpf = cpf, email = email, telefone = telefone };
_context.ADDUSociate(entity);
return "k";
}
catch (Exception exc)
{
string error = "f:" + exc.Message + "|" + exc.StackTrace;
// Trace.WriteLine("Erro no login: " + error , "Information");
return error;
}
}
addusassociate(我得到错误的地方)
public void ADDUSociate(UserClientEntity entity)
{
this.AddObject("UserEntities", new UserEntity { nome = entity.nome, cpf = entity.cpf, cidade = entity.cidade, email = entity.email, telefone = entity.telefone});
this.SaveChanges();
}
编辑:问题出在this.SaveChanges();
这可能是Azure字符大小写问题吗?可能您没有使用正确的"UserEntities"
的大小写。
这可能是因为您获得了对"fiscal"
表的引用,但您想将实体添加到"UserEntities"
表。
有一个很好的例子说明如何在这里添加实体:CloudTableClient。CreateTableIfNotExist方法