0

I have an application that is working perfect on my local machine but it gives an error when uploaded in a hosting space. I called the technical support of my hosting provider and they are not technical enough to know what the problem is, they only tell me that they do no allows full trust level.

below is the error I get when visiting my URL:

Server Error in '/' 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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.Delegate.DelegateConstruct(Object target, IntPtr slot) +0 Owin.Loader.DefaultLoader..ctor(Func'3 next, Func'2 activator, IEnumerable'1 referencedAssemblies) +69 Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +65 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +86 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

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

Screenshot of the error

Can anyone help me resolving this problem?

Juan
  • 4,910
  • 3
  • 37
  • 46
Kgabo
  • 9
  • 3

1 Answers1

0

You're calling the Microsoft.Owin DLLs and those require full trust, they won't run under medium trust. If your host won't support full trust, you'll need to find an alternative to Microsoft.Owin that DOES run in medium trust, or switch hosting providers to one who DOES support full trust.

See this post Is trying to develop for Medium Trust a lost cause? for more details.

Community
  • 1
  • 1
Tim
  • 4,217
  • 1
  • 15
  • 21
  • Thanks a lot Tim, this has solved my problem and my application is now running like a well-oiled machine. – Kgabo Feb 18 '16 at 07:29