2013-01-18 2 views
0

:윈도우 Azure 오류 C#이 오류 받고 있어요

f:Erro ao processar esta solicitação.| em System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse() em System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest() em System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options) em AzureTableLayer.CRUDUserEntities.ADDUSociate(UserClientEntity entity) na \WindowsAzureProject1\AzureTableLayer\User\CRUDUserEntities.cs:linha 43 em mobile.Service1.addusr(String nome, String cidade, String cpf, String email, String telefone) 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; 
     } 
    } 

ADDUSociate (내가지고있어 오류)

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()에 있습니다.

답변

1

Azure character casing issue 일 수 있습니까? 아마도 "UserEntities"에 대해 올바른 대소 문자를 사용하지 않았을 것입니다.

[업데이트] 당신이 "fiscal" 테이블에 대한 참조를 가져,하지만 당신은 "UserEntities" 테이블에 개체를 추가 할 수 있기 때문에

이 아마입니다.

여기에 엔티티 추가하는 방법의 좋은 예제가있다 : 매개 변수가 UserClientEntity 및 방법 ** ADDUSociate ** ** UserEntity **에 있고 매개 변수가 ** UserClientEntity 때문에 CloudTableClient.CreateTableIfNotExist Method

+0

은 ** – Ladessa

+0

좋아, 대답을 업데이트했습니다. –

관련 문제