默认 MVC 5 应用程序的安全例外 [英] Security Exception for default MVC 5 application

查看:18
本文介绍了默认 MVC 5 应用程序的安全例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将使用 VS 2013 生成的默认 MVC 5 应用程序部署到我的托管帐户时出现安全异常.

I got security exception when deploying the default MVC 5 app generated with VS 2013 to my hosting account.

有没有快速解决这个问题的方法?

Is there any quick solution for this problem?

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.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

SecurityException: Request for the 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 key) +0
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
   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) +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

谢谢,哈恰图尔

推荐答案

感谢您的回答.我的托管服务 (hostgator) 似乎无法使用 MVC5.

Thanks for your answers. It looks like I cannot use MVC5 with my hosting service (hostgator).

当前版本的 ASP.NET 现在只支持完全信任.女士有在发行说明中说明:ASP.NET MVC 5 不再支持部分信任....".特别是[程序集:AllowPartiallyTrustedCallers] 属性已从源代码.你可以阅读更多关于 ASP.NET 的官方立场Levi's 的回答是-trying-to-develop-for-medium-trust-a-lost-cause,其中还包括有关为何移除支持的进一步链接.

The current versions of ASP.NET now only support full trust. MS have stated in Release Notes: Known Issues that "ASP.NET MVC 5 no longer supports partial trust....". In particular the [assembly: AllowPartiallyTrustedCallers] attribute has been removed from the source code. You can read more about ASP.NET's official position in Levi's answer to is-trying-to-develop-for-medium-trust-a-lost-cause, which also includes further links to why support has been removed.

见:部署 ASP.NET MVC 项目

这篇关于默认 MVC 5 应用程序的安全例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆