4

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

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.

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?

4

1 回答 1

0

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

[assembly: AllowPartiallyTrustedCallers()]
于 2015-11-15T00:06:54.233 回答