我有一个ASP.Net MVC 4,与捆绑.net 4.5项目。当我将[Authorize]添加到我的Controller时,@ Scripts.Render和@ Styles.Render调用与“对象引用未设置为对象实例”打破。授权属性break @ Script.Render
我不能为我的生活工作出为什么!
有没有人遇到过这个?谁能帮忙?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Project.Models;
using Project.Repositories;
namespace Project.Controllers
{
[Authorize]
public class HomeController : Controller
这打破我_layout观点:
@model PageModel
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Project</title>
<meta name="description" content="">
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'/><meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no">
@Styles.Render("~/Content/bootstrap")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/initializr")
你有没有试过调试器?你在哪个对象上得到异常?向我们展示一些代码 – Dmitry 2013-03-14 17:32:40
嗨德米特里,我试过调试,但内部异常为空,堆栈跟踪显示没有用处......我无所适从。 – Doga 2013-03-14 17:40:51