我在默认的ASp.net模板基础上创建了一个全新的Visual 2013 MVC应用程序。但是,我收到一个错误消息请求,请求'System.Security.Permissions.ReflectionPermission类型的权限失败。
是否可以关闭此反射权限以使站点仍然工作?
这是我的web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="MyDb" connectionString="Data Source=x.x.com;Initial Catalog=x;User Id=x;Password=x;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<trust level="Full" />
<customErrors mode="Off"/>
<authentication mode="None" />
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>异常详细信息:'System.Security.Permissions.ReflectionPermission,mscorlib、Version=4.0.0.0、Culture=neutral、PublicKeyToken=b77a5c561934e089‘类型的权限请求失败。 >'System.Security.Permissions.ReflectionPermission,SecurityException:请求类型为Version=4.0.0.0、Version=4.0.0.0、Culture=neutral、PublicKeyToken=b77a5c561934e089‘的许可失败。(对象目标,Owin.Loader.DefaultLoader..ctor(Func
3 next, Func2槽) +0 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr激活器,IEnumerable1 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, Func1 valueFactory +115 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr上下文) +106 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext,HttpContext上下文,MethodInfo[]处理程序) +418 System.Web.HttpApplication.InitSpecial(HttpApplicationState状态,MethodInfo[]处理程序,IntPtr appContext,HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,+336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
我试着添加
<trust level="Full" />到我的Web.Config system.Web部分,但这不起作用,因为我有一个
此配置部分不能在此路径上使用。当站点管理员从继承的配置文件锁定了对此部分的访问权限时,就会发生这种情况。
它是共享主机在1和1.com,他们不会给我完全信任。
发布于 2013-11-15 18:50:08
我直接问了asp.net小组,这就是他们的反应
去年,我们正式宣布部分信任不再是应用程序隔离(http://support.microsoft.com/kb/2698981)的信任边界,因此,我们对共享主机提供商的建议是不再使用它。展望未来,我们不会支持部分信任我们为此而开发的新框架特性。
我知道很多人使用共享托管,而且由于主机提供商永远不会完全信任他们的共享托管产品,我猜微软做出了这个决定,这样他们就可以在Azure上获得更多的客户。
让我们这些在共享托管平台上销售客户的小型开发人员陷入困境。要么去更贵的主机,要么跳到天蓝色。
发布于 2014-10-16 15:59:09
http://www.codeproject.com/Questions/586223/SecurityplusExceptionpluscomingplusinplusaplusrunn
解决方案4 System.Security.SecurityException:请求“System.Net.SocketPermission、System、Version=4.0.0.0、Culture=neutral、PublicKeyToken=b77a5c561934e089”类型的权限失败
上述误差的跟随解
<system.web>
<customErrors mode="Off"/>
<trust level="Full" />
</system.web>为我的教区主持工作
发布于 2016-06-22 11:01:05
如果您有以下条件:
1)由于强制性的安全要求,必须使用信任级别中等或更低的级别。
2)使用ASP.Net 4.5
3)不需要使用Owin来允许外部身份验证提供者,如Google或Facebook。
4)应用程序错误信息表明,Owin参与了阻止应用程序在中等信任下启动的过程。
您可以将以下行添加到web.config AppSettings部分以禁用Owin,并且您应该能够使程序在中等信任级别上运行:
<add key="owin:AutomaticAppStartup" value="false" />https://stackoverflow.com/questions/19505770
复制相似问题