Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7501921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:41:41+00:00 2026-05-29T20:41:41+00:00

I created a new project of type Asp.net MVC 4 I installed the package

  • 0
  1. I created a new project of type Asp.net MVC 4
  2. I installed the package via Ninject.MVC3 NuGet Install Package Ninject.MVC3
  3. When running the project, security error:

Error

Server Error in ‘/MediumTrustSample’ Application.

Security Exception

Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the
required permission please contact your system administrator or change
the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the
permission of type ‘System.Security.Permissions.ReflectionPermission,
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089’ failed.

Source Error:

Line 20:
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule)); Line
21:
DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule));
Line 22: bootstrapper.Initialize(CreateKernel); Line 23:
} Line 24:

Source File: C:\Users\Riderman_2\Documents\Visual Studio
2010\Projects\MediumTrustSample\MediumTrustSample\App_Start\NinjectMVC3.cs
Line: 22

Stack Trace:

[SecurityException: Request for the permission of type
‘System.Security.Permissions.ReflectionPermission, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’
failed.]
System.Security.CodeAccessSecurityEngine.SpecialDemand(PermissionType
whatPermission, StackCrawlMark& stackMark) +0
System.Security.CodeAccessPermission.Demand(PermissionType
permissionType) +30
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture,
Boolean skipVisibilityChecks) +281
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
+38 Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition(MethodInfo
method, BindingFlags flags) in ExtensionsForMemberInfo.cs:145
Ninject.Infrastructure.Language.ExtensionsForMemberInfo.IsDefined(PropertyInfo
element, Type attributeType, Boolean inherit) in
ExtensionsForMemberInfo.cs:173
Ninject.Selection.Heuristics.StandardInjectionHeuristic.ShouldInject(MemberInfo
member) in StandardInjectionHeuristic.cs:47
Ninject.Selection.<>c_DisplayClass3.b_2(IInjectionHeuristic h) in Selector.cs:92 System.Linq.Enumerable.Any(IEnumerable1
source, Func
2 predicate) +149
Ninject.Selection.Selector.b_1(PropertyInfo
p) in Selector.cs:92
System.Linq.WhereEnumerableIterator1.MoveNext() +156
System.Collections.Generic.List
1.InsertRange(Int32 index,
IEnumerable1 collection) +552
Ninject.Selection.Selector.SelectPropertiesForInjection(Type type) in
Selector.cs:89
Ninject.Planning.Strategies.PropertyReflectionStrategy.Execute(IPlan
plan) in PropertyReflectionStrategy.cs:60
Ninject.Planning.<>c__DisplayClass3.<GetPlan>b__1(IPlanningStrategy s)
in Planner.cs:68
Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map(IEnumerable
1
series, Action1 action) in ExtensionsForIEnumerableOfT.cs:23
Ninject.Planning.Planner.GetPlan(Type type) in Planner.cs:70
Ninject.Activation.Context.Resolve() in Context.cs:180
Ninject.KernelBase.<Resolve>b__7(IContext context) in
KernelBase.cs:375
System.Linq.WhereSelectEnumerableIterator
2.MoveNext() +238
System.Linq.Enumerable.SingleOrDefault(IEnumerable1 source) +299
Ninject.Planning.Targets.Target
1.GetValue(Type service, IContext
parent) in Target.cs:179
Ninject.Planning.Targets.Target1.ResolveWithin(IContext parent) in
Target.cs:147
Ninject.Activation.Providers.StandardProvider.GetValue(IContext
context, ITarget target) in StandardProvider.cs:97
System.Linq.WhereSelectArrayIterator
2.MoveNext() +110
System.Linq.Buffer1..ctor(IEnumerable1 source) +488
System.Linq.Enumerable.ToArray(IEnumerable1 source) +104
Ninject.Activation.Providers.StandardProvider.Create(IContext context)
in StandardProvider.cs:81 Ninject.Activation.Context.Resolve() in
Context.cs:157 Ninject.KernelBase.<Resolve>b__7(IContext context)
in KernelBase.cs:375
System.Linq.WhereSelectEnumerableIterator
2.MoveNext() +238
System.Linq.d
_b11.MoveNext() +296
System.Linq.Enumerable.Single(IEnumerable
1 source) +282
Ninject.ResolutionExtensions.Get(IResolutionRoot root, IParameter[]
parameters) in ResolutionExtensions.cs:37
Ninject.Web.Mvc.Bootstrapper.Initialize(Func`1 createKernelCallback)
in Bootstrapper.cs:72
MediumTrustSample.App_Start.NinjectMVC3.Start() in
C:\Users\Riderman_2\Documents\Visual Studio
2010\Projects\MediumTrustSample\MediumTrustSample\App_Start\NinjectMVC3.cs:22

Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.272

Question

How to use Ninject.MVC3 with MediumTrust?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:41:44+00:00Added an answer on May 29, 2026 at 8:41 pm

    Go and get the medium trust version: https://github.com/ninject/ninject/downloads

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I create a New Project of type ASP.Net MVC Web Application, I expect
I'm working in an ASP.NET MVC project where I have created a two LinqToSQL
using VS 2008 i created a clean asp.net MVC application project and changed nothing
I create new asp.net mvc 3 project. Copy there all controllers, classes and views
I am starting a project in ASP.NET MVC using Ninject to implement dependency injection.
i am using asp.net framework 4 and i have created brand new project and
I have created a new VS2008 ASP.Net Web service project, with the default name
I'm trying out sharp-architecture (and ASP.NET MVC) for a new project after being on
My project is created based on ASP.Net MVC Web API 4 application. If it's
Because I need to build a very strongly-typed & type-safed project for Asp.net MVC.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.