locked
Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed. RRS feed

  • Question

  • User-1275199051 posted

    I have updated an ASP.NET site from 3.5/4.0 to 4.5.2. I am getting the following error when I try to run it. I use GoDaddy for Hosting. Any help would be greatly appreciated. Meanwhile, I am combing through my web.config and Google for additional resources.

    Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed.

    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.  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.

    [MethodAccessException: Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed.
    
    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.  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.]
       Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start() +19
    
    [InvalidOperationException: The pre-application start initialization method Start on type Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed.
    
    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.  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.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +548
       System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +94
       System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +164
       System.Web.Compilation.BuildManager.ExecutePreAppStart() +108
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +597
    
    [HttpException (0x80004005): The pre-application start initialization method Start on type Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed.
    
    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.  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.HttpRuntime.FirstRequestInit(HttpContext context) +553
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +190

    My web.config file:

    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468  -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
      </configSections>
      <appSettings>
        <!-- Encryption Keys -->
        <add key="ASM.ED" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
      </appSettings>
      <connectionStrings>
        <add name="ASMConnectionString" connectionString="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;" providerName="System.Data.SqlClient"/>
        <add name="DefaultConnection" connectionString="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" providerName="System.Data.SqlClient"/>
        <!--<add name="DefaultConnection" connectionString="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" providerName="System.Data.SqlClient" />-->
      </connectionStrings>
      <!--
        For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
    
        The following attributes can be set on the <httpRuntime> tag.
          <system.Web>
            <httpRuntime targetFramework="4.5" />
          </system.Web>
      -->
      <system.web>
    
        <trust level="Full" legacyCasModel="true"/>
        <httpRuntime targetFramework="4.5.2"/>
        
        <customErrors mode="Off"/>
        <authentication mode="None"/>
        <pages enableSessionState="true">
          <namespaces>
            <add namespace="System.Web.Optimization"/>
            <add namespace="Microsoft.AspNet.Identity"/>
          </namespaces>
          <controls>
            <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
          </controls>
        </pages>
        <membership>
          <providers>
            <!-- ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template -->
            <clear/>
          </providers>
        </membership>
        <profile>
          <providers>
            <!-- ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template -->
            <clear/>
          </providers>
        </profile>
        <roleManager>
          <!-- ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template -->
          <providers>
            <clear/>
          </providers>
        </roleManager>
        <!-- If you are deploying to a cloud environment that has multiple web server instances,
                you should change session state mode from "InProc" to "Custom". In addition,
                change the connection string named "DefaultConnection" to connect to an instance
                of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express. -->
        <sessionState mode="InProc" customProvider="DefaultSessionProvider">
          <providers>
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
          </providers>
        </sessionState>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.5.2">
        </compilation>
      </system.web>
      <system.webServer>
        <modules>
          <remove name="FormsAuthentication"/>
        </modules>
        <httpErrors errorMode="Detailed"/>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
            <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089"/>
            <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
          </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>
          <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.WebPages" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="mssqllocaldb"/>
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
        </providers>
      </entityFramework>
      <system.codedom>
        <compilers>
          <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
        </compilers>
      </system.codedom>
    </configuration>


    Monday, April 4, 2016 10:24 PM

Answers

  • User-1275199051 posted

    I tried that and still got the same error.

    I solved this problem by removing the codedom section in the web.config file. GoDaddy must not allow on-the-fly compilation with codedom.

    I rebuilt the website after removing the codedom reference in web.config and re uploaded my website and everything worked out.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 6, 2016 3:14 AM

All replies

  • User-166373564 posted

    Hello,

    'Microsoft.ScriptManager.MSAjaxv45.PreApplicationStartCode.Start()' to access security critical method 'System.Web.UI.ScriptManager.get_ScriptResourceMapping()' failed.
     
    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.  To enable this assembly to be used by partial trust or security transparent code,

    According to the error message above, you could try the code snippet below:

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

    Have a good day.

    Regards,

    Angie

    Tuesday, April 5, 2016 7:46 AM
  • User-1275199051 posted

    I tried that and still got the same error.

    I solved this problem by removing the codedom section in the web.config file. GoDaddy must not allow on-the-fly compilation with codedom.

    I rebuilt the website after removing the codedom reference in web.config and re uploaded my website and everything worked out.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 6, 2016 3:14 AM