I'm getting an odd error with a MVC 3.0 RC project.
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)
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.
UPDATE
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.
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.
For example, some other scenarios that don't work are using dynamic dispatch in VB in a Medium Trust application.
精彩评论