我有一个 mvc4 Web 应用程序。我决定使用 ninject.mvc3。所以我从nuget安装了它。但它抛出了这个异常:


private static IKernel CreateKernel()
      {
          var kernel = new StandardKernel(); //Throws exception this line
          kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
          kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
          return kernel;
      }

任何想法是什么导致了这种情况?

最佳答案

如果您将以下行添加到您的 AssemblyInfo.cs 文件并引用 System.Web.Security 命名空间,也许会有所帮助。

[assembly: AllowPartiallyTrustedCallers()]

关于asp.net-mvc - 类型 : 'Ninject.Web.Mvc.Filter.FilterContextParameter' in mvc4 违反了 ninject 继承安全规则,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11827253/

10-13 06:49