在MVC 3项目奇数异常 [英] Odd Exception in MVC 3 Project

查看:191
本文介绍了在MVC 3项目奇数异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一个奇怪的错误与MVC 3.0 RC的项目。

I'm getting an odd error with a MVC 3.0 RC project.

这似乎是苦恼不是我的应用程序的均匀的AppDomain
这是昨天做工精细,不知道是什么改变了。

It seems that it is upset about my application not being a homogenous AppDomain It was working fine yesterday, not sure what's changed.

System.InvalidOperationException was unhandled by user code
Message=Dynamic operations can only be performed in homogenous AppDomain.
Source=System.Core
StackTrace:
    at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)
    at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
    at ASP.Index_cshtml.Execute() in c:\Projects\RealJobs.Branch\RealJobs.MVC\Views\Jobs\Index.cshtml:line 5
    at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
    at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
    at System.Web.WebPages.StartPage.RunPage()
    at System.Web.WebPages.StartPage.ExecutePageHierarchy()
    at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
    at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
    at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
    at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
    at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)

当View.Title在Index.cshtml被修改,该例外被抛出

The exception is been thrown when the View.Title is modified in the Index.cshtml

@{
   View.Title = "Jobs | realjobs.com.au";
}

任何想法?谷歌没有产生喜悦。

Any ideas? Google yielded no joy.

好像真的不喜欢我在web.config中不断变化的信任

Seems like it really didn't like me changing the trust in the web.config

我已经添加了以下行来解决另一个问题:

I'd added the following line to get around another issue:

<trust legacyCasModel="true" level="Full"/>

在删除它再次工作。设计是这样吗?

Once removed it is working again. Is this by design?

推荐答案

是的,我认为,这是预期。

Yes, I believe that this is expected.

有使用动态调度像这样的一些限制。在.NET 4中新的动态的功能并不意味着用于这样的事情,但可以肯定的是不错的,当它工作了巨大的在许多情况下。 动态的主要目的是为更好的COM互操作。

There are some limitations with using dynamic dispatching like this. The new dynamic feature in .NET 4 wasn't meant to be used for things like this, but it sure is nice when it works out great in many cases. The main intention of dynamic was for better COM interop.

例如,不使用在VB动态调度在中等信任应用程序。其他一些场景

For example, some other scenarios that don't work are using dynamic dispatch in VB in a Medium Trust application.

这篇关于在MVC 3项目奇数异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆