“当前信任级别的另一种解决方法是不允许使用'compilerOption'属性”错误 [英] Another workaround for "The current trust level does not allow use of the ‘compilerOption’ attribute" error

查看:82
本文介绍了“当前信任级别的另一种解决方法是不允许使用'compilerOption'属性”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在为一家TI公司工作,在我们的测试中,当我们尝试打开网站下载我们产品的客户时发现了这个问题,Site中显示的错误是:"当前的信任级别不允许使用'compilerOption'属性 "


对于其他主题,我已经读过通过将中等信任级别更改为完整来解决问题,但此解决方案会危及整个安全性我的问题是我们服务器的IIS还有另一个针对同一问题的解决方案,它不会影响整个IIS。


我希望有人可以帮我解决这个问题。


问候





解决方案


嗨jose


此论坛 适用于Windows Server 2008应用程序兼容性和认证问题。但是,
根据我的理解,您可以更改站点配置,而不是更改IIS设置,如下所示!
解决方案1:



要解决此问题,您必须删除compilerOptions 设置和warningLevel 设置,在创建或迁移后从web.config文件的配置部分设置应用。更改后,设置应如下所示:


< system.codedom>
< compilers>
< compiler language =" c# ; CS; CSHARP"延长="&的.cs QUOT;
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"延长="&的.vb QUOT;
type =" Microsoft.VisualBasic.VBCodeProvider,System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089">
< providerOption name =" CompilerVersion" value =" v3.5" />
< / compiler>
< / compilers>
< /system.codedom>


解决方案2:



要解决此问题,请打开web.config文件并添加/更改信任级别如下:


<&的System.Web GT;
< trust level =" Full" />
< /system.web>


最后,重建项目。


关心
Omanakuttan MK



注意 - 免责声明


< p class = MsoNormal style ="margin:0in 0in 0pt">


使用以下材料或示例代码即表示您同意遵守以下许可条款和Microsoft合作伙伴计划协议,其条款在此引用作为参考。这些许可条款是Microsoft Corporation(或者,如果适用,基于您所在地,其关联公司)与您之间的协议。我们提供给您的任何材料(示例代码除外)仅供您内部使用。提供任何示例代码仅用于说明目的,并非旨在用于生产环境。我们授予您非独家,免版税的使用和修改示例代码的权利,并复制和分发示例代码的目标代码形式,前提是您同意:(i)不使用Microsoft的名称,徽标或商标销售您的软件,其中嵌入了示例代码; (ii)在您的软件产品中包含有效的版权声明,其中嵌入了示例代码; (iii)代表分包商并为分包商的利益提供免责声明,免除间接和后果性损害的责任以及责任的责任限制; (iv)对使用或分发样本代码而产生或导致的任何第三方索赔或诉讼(包括律师费)的Microsoft,其附属公司和供应商进行赔偿,保护无害和保护。




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


解决方案

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.



这篇关于“当前信任级别的另一种解决方法是不允许使用'compilerOption'属性”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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