ERROR System.InvalidOperationException: The sequence contains more than one element [closed]

1

I have a system that works on several machines, but in a machine the error occurs:

'The string contains more than one element Description: An unhandled exception occurred during the execution of the current Web request. Examine the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The string contains more than one element

Source Error:

Unhandled exception was generated during the execution of the current Web request. Information regarding the source and location of the exception can be identified using the exception stack trace below.

Battery Tracking:

[InvalidOperationException: The stream contains more than one element]    System.Linq.Enumerable.SingleOrDefault (IEnumerable 1 source) +4098162 System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2(IEnumerable 1 sequence) +40    System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle (IEnumerable'1 query, Expression queryRoot) +60    System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider '

The system accesses the following action

string Login = GetUser ();

        Ramal ramal = db.Ramais.SingleOrDefault(r => r.sCodFunc == Login);

        if (ramal == null)
        {
            Session["UserAdm"] = false;
        }
        else
        {
            Session["UserAdm"] = ramal.bAdmSist;
        }

        ViewBag.ListaMes = MontaListaMes();
        ViewBag.Area = (from c in db.Area orderby c.sNome select c).ToArray();

        //return View();

        //Exibir os aniversariantes do mês

        string MesAniversario = DateTime.Today.ToString("MM");
        string DiaAniversario = DateTime.Today.ToString("dd");


        //Coloca em primeiro o aniversariante do dia, e em seguida do mes.
        Ramal[] RamalAniver = (from c in db.Ramais
                               where c.sAniversario.Contains("/" + MesAniversario) && c.bAtivo == true
                               orderby c.sAniversario
                               select c
                               ).ToArray();


        RamalAniver = RamalAniver.OrderByDescending(x => x.sAniversario == DiaAniversario 
            + "/" + MesAniversario).ThenBy(x => x.sAniversario).ToArray();


        return View(RamalAniver.ToList());

        //return View(AniverDia.Union(AniverMes).ToList());

    private string GetUser()
    {

        var Aux = User.Identity.Name.Split('\');
        return Aux[1];
    }

Has anyone seen this problem yet?

    
asked by anonymous 10.11.2017 / 21:01

0 answers