0
In the config of my application I deleted the customErrors to make a test of an error that is difficult to replicate.
And where must be going the error I put a Try:
if (ModelState.IsValid)
{
db.TarefaHoras.Add(tarefaHora);
try
{
db.SaveChanges();
}
catch (DbUpdateException ex)
{
ErroDetalhe erro = new ErroDetalhe();
erro.Data = tarefaHora.Data;
erro.UsuarioId = tarefaHora.ApplicationUserId;
erro.JSON = JsonConvert.SerializeObject(tarefaHora);
erro.Tipo = "TarefaHora";
erro.Controller = "TarefaHoras";
erro.Action = "Create Post";
erro.Exception = ex.GetType().FullName;
db.ErroDetalhes.Add(erro);
db.SaveChanges();
return RedirectToAction("ErroNaAtualizacaoDaBase", "Erros", new { id = erro.ID });
}
return RedirectToAction("Index", "Home");
}
ViewBag.TipoTarefaID = new CBMMSapp.DAO.TiposTarefaDAO().ListaParaDropDown();
ViewBag.ApplicationUserId = new CBMMSapp.DAO.UsuariosDAO().ListaParaDropDown(tarefaHora.ApplicationUserId);
ViewBag.ClienteID = new CBMMSapp.DAO.ClientesDAO().ListaParaDropDown();
return View(tarefaHora);
}
This error only happens at runtime and only on the Azure server, so my attempt was to get a better description of the error and for this I created a table where the information is deposited.
But....
The problem is that the Error View I am receiving is not the Erroneous View updatedwhatever base I created that is redirected in Catch.
It is the standard Aspnet Error View.
Then I went to Shared views and deleted the default page and removed the customErrors from the web.config.
And yet Azure still brings the standard Error View.
Does anyone have any idea what might be going on?
Remove Savechanges from inside the catch. If that’s the error, you must be having an untreated ex.
– Thiago Lunardi