在locahost上运行MVC3网站时,出现此错误。这是刚创建的一个新的MVC3网站,HomeController
赋值是从其中抛出Index
ViewBag.Message
方法的。
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
堆栈跟踪:
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 MVC3.Web.UI.Controllers.HomeController.Index() in C:\Users\mccarthy\Documents\Visual Studio 2010\Projects\MVC3\MVC3.Web.UI\Controllers\HomeController.cs:line 13
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
我不知道这个错误是什么,并且之前从未见过。当我启动一个新的MVC2项目时(到目前为止我一直在用尽的东西),该站点可以正常运行。
Microsoft在MVC3和MVC2框架之间如何对待安全性?
最佳答案
好的,看来,如果您的web.config中包含以下行:<trust legacyCasModel="true" level="Full" />
可能会发生这种类型的错误。但是在PHeiberg提供给我的链接中,它表示该行可能在web.config中。我的web.config没有它。
因此,我查看了machine.config,并找到了代码行!我已将其注释掉,现在可以运行我的MVC3应用程序。
我不太确定它如何最终出现在machine.config中,或者由于我将其注释掉而导致其他问题,但是这个紧迫的问题已得到解决。
关于asp.net - "Dynamic operations can only be performed in homogenous AppDomain"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8761113/