我做这在存储添加用户的方法。 下面是代码和我得到的错误。
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"));
var _context = new CRUDUserEntities(_account.TableEndpoint.ToString(), _account.Credentials);
if (_context.Select(cpf).Count() > 0)
return "dup";
var account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
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;
}
}
当我尝试添加用户...我得到这个错误:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
f:An error occurred while processing this request.| at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
at Microsoft.WindowsAzure.StorageClient.CommonUtils. <LazyEnumerateSegmented>d__0`1.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at mobile.Service1.addusr(String nome, String cidade, String cpf, String email, String telefone)
</string>
我不知道什么是错的..