none
Another workaround for "The current trust level does not allow use of the ‘compilerOption’ attribute" error RRS feed

  • Question

  • Hi, I'm working for a TI company and during our test we found this issue when we try to open the Site to download a client of our product, the error showed in Site was this: "The current trust level does not allow use of the 'compilerOption' attribute

    For other topics I have read that the problem is solved by changing the Medium trust level to Full, but this solution compromises the whole security of the IIS of our server, my question, is there another solution for the same issue, that doesn’t compromises the whole IIS.

    I hope someone can help me with this issue.

    Regards




    Friday, November 13, 2009 5:55 PM

All replies

  • Hi jose

    This forum is meant for Windows server 2008 Application compatibility and certification issues. However,
    as per my understanding, Instead of changing the IIS settings you can change site configuration as follows!
    Solution 1:

     

    To solve the problem, you have to remove the compilerOptions setting and the warningLevel setting, from configuration section in web.config file after creating or migrating the application. After the change, the settings should appear as follows:

    <system.codedom>
       <compilers>
          <compiler language="c#;cs;csharp" extension=".cs"
             type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <providerOption name="CompilerVersion" value="v3.5"/>
          </compiler>
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
             type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <providerOption name="CompilerVersion" value="v3.5"/>
          </compiler>
       </compilers>
    </system.codedom>

    Solution 2:

     

    To solve the problem open the web.config file and add/change the trust level as follows:

    <system.web>   
       <trust level="Full"/>
    </system.web>

    Finally, rebuild the project.

    Regards
    Omanakuttan M.K.


    NOTE - Disclaimer

     

    By using the following materials or sample code you agree to be bound by the license terms below and the Microsoft Partner Program Agreement the terms of which are incorporated herein by this reference. These license terms are an agreement between Microsoft Corporation (or, if applicable based on where you are located, on of its affiliates) and you. Any materials (other than sample code) we provide to you are for your internal use only. Any sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object code form of the sample code, provided that you agree: (i) to not use Microsoft's name, logo, or trademarks to market your software produced in which the sample code is embedded; (ii) to include a valid copyright notice on your software product in which the sample code is embedded; (iii) to provide on behalf of and for the benefit of your subcontractors a disclaimer of warranties, exclusion of liability for indirect and consequential damages and a responsible limitation of liability; and (iv) to indemnify, hold harmless, and defend Microsoft, its affiliates and suppliers from and against any third party claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of the sample code.


    Wednesday, November 18, 2009 2:44 PM