简体   繁体   中英

Problem in website that it's not in localhost(on IIS)

I've launched my website on a host and I activated the debugging mode to see Errors details,but when I want to use (ShowExam) controller it shows an error[other controllers don't show any error] that I don't see it on IIS (on my localhost).I'm really confused! How can I fix it? 在此处输入图片说明

[Authorize]
    public ActionResult ShowExam(int id)
    {
        var Exam = db.SpeedReading_Exams.Find(id);
        if (Exam==null||Exam.SpeedReading_Exams_Questions.Count()==0)
        {
            return View("ExamNotFound");
        }
        var Results = db.SpeedReading_Exams_Results;
        var UserID = GetUserDetails.GetUser(User.Identity.Name).Id;
        if (Results.Any(r => r.UserId == UserID && r.SpeedReading_Exams_ID == id))
        {
            return View("AccessDenided");
        }
        SpeedReading_Exams_Results speedReading_Exams_Result = new SpeedReading_Exams_Results()
        {
            Score = 0,
            SpeedReading_Exams_ID = id,
            SpeedReading_Rate = 0,
            UserId = UserID
        };
        db.SpeedReading_Exams_Results.Add(speedReading_Exams_Result);
        Exam.SpeedReading_Exams_Visits++;
        db.Entry(Exam).State = System.Data.Entity.EntityState.Modified;
        db.SaveChanges();
        ViewBag.KeyWords = Exam.SpeedReading_Exams_KeyWords.Replace('-',',');
        ViewBag.Description = Exam.SpeedReading_Exams_Description;
        ViewBag.WordsCount = TextHelper.GetWordsCount(Exam.SpeedReading_Exams_Text);
        return View(Exam);
    }

I've launched my website on a host and I activated the debugging mode to see Errors details,but when I want to use (ShowExam) controller it shows an error[other controllers don't show any error] that I don't see it on IIS (on my localhost).I'm really confused! How can I fix it? 在此处输入图片说明

[Authorize]
    public ActionResult ShowExam(int id)
    {
        var Exam = db.SpeedReading_Exams.Find(id);
        if (Exam==null||Exam.SpeedReading_Exams_Questions.Count()==0)
        {
            return View("ExamNotFound");
        }
        var Results = db.SpeedReading_Exams_Results;
        var UserID = GetUserDetails.GetUser(User.Identity.Name).Id;
        if (Results.Any(r => r.UserId == UserID && r.SpeedReading_Exams_ID == id))
        {
            return View("AccessDenided");
        }
        SpeedReading_Exams_Results speedReading_Exams_Result = new SpeedReading_Exams_Results()
        {
            Score = 0,
            SpeedReading_Exams_ID = id,
            SpeedReading_Rate = 0,
            UserId = UserID
        };
        db.SpeedReading_Exams_Results.Add(speedReading_Exams_Result);
        Exam.SpeedReading_Exams_Visits++;
        db.Entry(Exam).State = System.Data.Entity.EntityState.Modified;
        db.SaveChanges();
        ViewBag.KeyWords = Exam.SpeedReading_Exams_KeyWords.Replace('-',',');
        ViewBag.Description = Exam.SpeedReading_Exams_Description;
        ViewBag.WordsCount = TextHelper.GetWordsCount(Exam.SpeedReading_Exams_Text);
        return View(Exam);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM