ninject違反類型的繼承安全規則:mvc4中的'Ninject.Web.Mvc.Filter.FilterContextParameter'

[英]ninject Inheritance security rules violated by type: 'Ninject.Web.Mvc.Filter.FilterContextParameter' in mvc4


I have a mvc4 web application. I decided to use ninject.mvc3. so I installed it from nuget. But it is throwing this exception:

我有一個mvc4 Web應用程序。我決定使用ninject.mvc3。所以我從nuget安裝它。但它拋出了這個例外:

Inheritance security rules violated by type: 'Ninject.Web.Mvc.Filter.FilterContextParameter'. Derived types must either match the security accessibility of the base type or be less accessible.

違反類型的繼承安全規則:'Ninject.Web.Mvc.Filter.FilterContextParameter'。派生類型必須與基本類型的安全可訪問性匹配,或者不易訪問。

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;
      }

Any ideas what is causing this?

是什么原因引起了這個?

1 个解决方案

#1


0  

Maybe it will help if you add the following line to your AssemblyInfo.cs file with a reference to the System.Web.Security namespace?.

如果您通過引用System.Web.Security命名空間將以下行添加到AssemblyInfo.cs文件中,它可能會有所幫助嗎?

[assembly: AllowPartiallyTrustedCallers()]

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/08/06/721305d06df8a4cce93de0a3ff9580fc.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com