开发者

Razor view errors not displaying source code

Whenever an error is thrown in my Razor view (.cshtml), I get a yellow screen that states

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To en开发者_开发问答able this, please follow one of the below steps, then request the URL:

It then says to either set the <@ Page Debug="true"> in the view or set the <compilation debug="true"> in the web.config.

I checked my web.config and the <compilation debug="true"> is already set. To exhaust other options, I tried adding it to all the web.config files in the view folders, but no change.

I also checked that the projects are being compiled as Debug and not Release. Any thoughts as to why the source code where the error is being thrown is not being displayed?

Edit: My application was updated from ASP.NET MVC 2 to MVC 3.


Apparently source errors are not displayed when the trust level is set to medium.

I forgot to remove <trust level="medium" /> from the web.config file after I was done testing in medium trust.


1)
source errors does not appear if you do not insert
customErrors mode="Off"
and
compilation debug="true"
in your web.config
2)
when you're in medium trust you can use mvc3 provided you :
cast your return view(xxx) to return view((Object)xxx)
or, in vb: return view(xxx) to return DirectCast(view(xxx), Object) 
and
 Return View(model) to Return View((Object)model)
 or  to Return View(DirectCast(model, Object))

and
you do not use @ViewBag
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜