Security Exception
See original GitHub issueHi Developers
I’m developing two projects, one ASP.NET MVC and one Web API, both using Framework 4.5.2, nothing different from what we traditionally used in our projects. These common projects use Owin and the public on a server where it is set up as Medium Trust, send the error below:
Exception Details: System.Security.SecurityException: Request permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089' failed.
[SecurityException: Request permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089' failed.]
Microsoft.Owin.Host.SystemWeb.Infrastructure.DefaultTraceFactory.InitializeTraceSource (String) +0
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd (TKey key, Func`2 valueFactory) +62
Microsoft.Owin.Host.SystemWeb.Infrastructure.DefaultTraceFactory.GetOrAddTraceSource (String name) +52
Microsoft.Owin.Host.SystemWeb.Infrastructure.DefaultTraceFactory.Create (String name) +28
Microsoft.Owin.Host.SystemWeb.OwinAppContext..ctor () +43
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build (Action`1 startup) +30
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint () +70
System.Threading.LazyInitializer.EnsureInitializedCore (T & target, Boolean & initialized, Object & syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init (HttpApplication Context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS (IntPtr appContext, HttpContext context, MethodInfo [] handlers) +534
System.Web.HttpApplication.InitSpecial (HttpApplicationState state, MethodInfo [] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance (intPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication (IntPtr appContext) +296
What I identified was at the same time, and use the Microsoft.Owin.Host.SystemWeb to hide this trust problem. What I know is also how libraries have the desired name The strong name and host on which an application is to run can not this type of configuration changed by company rules accounts (a company and a Locaweb). I have already tried to download the source and recompile, including System.Security.AllowPartiallyTrustedCallers but I have not yet succeeded.
Has anyone ever had the same problem and would know a way around it? Remembering that I can not have your Level Trust settings changed.
Thank you in advance! Raphael Cardoso
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (2 by maintainers)
Top GitHub Comments
Thanks, I’ll evaluate your suggestion.
@ferronicardoso
If you are changing host, take the time to price and consider Azure. If you are hosting your clients, Elastic Pools allows you to share the load of multiple database over one pool of data with an easy migration path to a dedicated database.
Same thing can also be done with Multiple AppServices over Hosting Plan.
Can be a real cost saver.