简体   繁体   English

无法将System.Web.Extensions应用于PartialTrustVisibleAssemblies列表

[英]Cannot Apply System.Web.Extensions to PartialTrustVisibleAssemblies List

In the web.config of webforms .net 4.5 application I set the following: 在webforms .net 4.5应用程序的web.config中,我进行了以下设置:

<trust legacyCasModel="true" level="Full" />

because this is a Microsoft work around to overcome an bug in the asp.net Report Viewer which causes large reports to take much longer to generate than in previous .net versions (3.5 and older). 因为这是Microsoft的一种解决方法,它可以解决asp.net报表查看器中的一个错误,该错误导致大型报表的生成时间比以前的.net版本(3.5及更早版本)要长得多。 Unfortunately, enabling the legacy CasModel has caused the error below. 不幸的是,启用旧版CasModel会导致以下错误。 As the error suggests I have attempted many times to apply an exception in my site's web.config such as: 如错误所示,我已经尝试过多次在网站的web.config中应用异常,例如:

<system.web>
        <partialTrustVisibleAssemblies>
            <add assemblyName="System.Web.Extensions" version="4.0.0" publicKey="0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9" />
        </partialTrustVisibleAssemblies>
</system.web>

But the error still occurs. 但是错误仍然发生。 I also attempted to apply this setting to the .net 4 web.config and specify this assembly to have full trust but it still won't work. 我也尝试将此设置应用于.net 4 web.config并指定此程序集具有完全信任,但仍然无法正常工作。 I've read a ton of documentation pertaining to this issue and I cannot locate any other way this issue maybe resolved (except to remove this assembly in my project or make other major changes to my web application). 我已经阅读了大量与该问题有关的文档,但无法找到解决该问题的任何其他方式(除了在项目中删除此程序集或对Web应用程序进行其他重大更改外)。 Any suggestions of how I can fix or address this issue would be greatly appreciated, Thanks. 非常感谢任何有关如何解决或解决此问题的建议。

Server Error in '/' Application. “ /”应用程序中的服务器错误。 Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed. 尝试通过安全透明方法'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()'访问安全关键方法'System.Web.UI.ScriptManager.get_ScriptResourceMapping()'失败。 Assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is a conditionally APTCA assembly which is not enabled in the current AppDomain. 程序集'System.Web.Extensions,版本= 4.0.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'是有条件的APTCA程序集,当前应用程序域中未启用该程序集。 To enable this assembly to be used by partial trust or security transparent code, please add assembly name 'System.Web.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9' to the the PartialTrustVisibleAssemblies list when creating the AppDomain. 为了使该组件由部分信任或安全性的透明的代码中使用,请在创建应用程序域时添加组件名称“System.Web.Extensions程序,公钥= 0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9”到的PartialTrustVisibleAssemblies列表。 Description: An unhandled exception occurred during the execution of the current web request. 说明:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code. 请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。 Exception Details: System.MethodAccessException: Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed. 异常详细信息:System.MethodAccessException:安全透明方法'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()'尝试访问安全性关键方法'System.Web.UI.ScriptManager.get_ScriptResourceMapping()'失败。 Assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is a conditionally APTCA assembly which is not enabled in the current AppDomain. 程序集'System.Web.Extensions,版本= 4.0.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'是有条件的APTCA程序集,当前应用程序域中未启用该程序集。 To enable this assembly to be used by partial trust or security transparent code, please add assembly name 'System.Web.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9' to the the PartialTrustVisibleAssemblies list when creating the AppDomain. 为了使该组件由部分信任或安全性的透明的代码中使用,请在创建应用程序域时添加组件名称“System.Web.Extensions程序,公钥= 0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9”到的PartialTrustVisibleAssemblies列表。

尝试从引用中删除“ Microsoft.ScriptManager.MSAjax.dll”和“ Microsoft.ScriptManager.WebForms.dll”(如果未使用)。

@Sachin, thank you for your answer however I need those assemblies for this project so that would not resolve this issue. @Sachin,谢谢您的回答,但是我需要该项目的那些程序集,才能解决该问题。 I resolved this issue a while ago. 我不久前解决了这个问题。 I think this error was occurring when attempting some authentication functions in the application. 我认为在应用程序中尝试某些身份验证功能时发生此错误。 I resolved the issue by setting the report function to open in a new application pool, so that the enabling of the legacy CAS model only effects the new application pool and therefore not effecting other authentication functions in the application. 我通过将报告功能设置为在新的应用程序池中打开解决了该问题,因此启用旧式CAS模型仅影响新的应用程序池,因此不影响应用程序中的其他身份验证功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM