我正在创建一个MVC 4应用程序,我有如下错误.
我尝试了很多东西,但我找不到问题所在.这是我的Controller源码
public ActionResult Index(string EventId) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["User"]; if (cookie != null) { string Type = (cookie["Type"] == null || cookie["Type"] == "") ? null : cookie["Type"].ToString(); string Username = (cookie["Username"] == null || cookie["Username"] == "") ? null : cookie["Username"].ToString(); ViewBag.Message = Type; ViewBag.Username = Username; try { string ReplaceEventID = EventId.Replace('-', '/'); ViewBag.Message = ReplaceEventID; IEnumerableJobListRelatedToEvent = DBContext.Jobs.Where(x => x.EventId == ReplaceEventID); return View(JobListRelatedToEvent); } catch { return View(); } } else { return RedirectToAction("Index", "Home"); } }
更新: 当它在我的本地机器上运行时它工作正常,但在我发布到服务器后,我得到了这个错误.
谁能说出错是什么意思?
我遇到了同样的问题,如果自定义错误打开,我们会遇到这个问题.
您需要在web.config中进行更改并添加以下代码.因此,您将获得应用程序的实际错误或代码级别.
<system.web>
<customErrors mode="Off" />