信任级别不允许使用'compilerOptions'属性 [英] trust level does not allow use of the 'compilerOptions' attribute

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

问题描述

我有一段时间的魔鬼般的经历,将几个已经转换为VB 2005的VB 2003 Web应用程序运行在我使用的远程服务器上……我能够在我的服务器上调试/运行它们本地开发机器.问题似乎集中在这些应用程序的web.config文件周围.它们每个都包含< compilation>.带有嵌入式< compiler>的元素和< compiler ...>子元素. <编译器...>元素具有许多属性,包括compilerOptions.当我从服务器运行每个应用程序时,都会收到以下消息:

I am having a devil of a time getting a couple of VB 2003 web apps that have been converted to VB 2005 to run on the remote server I use ... I am able to debug/run them on my local development machine.  The problem seems to be centered around the web.config files for these apps.  They each contain <compilation> elements with embedded <compilers> and <compiler ...> child elements.  The <compiler ...> element has a number of attributes including compilerOptions.  When I run each app from the server I get the following message:

解析器错误消息:当前的信任级别不允许使用'compilerOptions'属性

Parser Error Message: The current trust level does not allow use of the 'compilerOptions' attribute

我一直与服务器人员保持联系(在那里我一直很轻松地运行带有.Net 1.0的VB 2003版本),他们声称他们已经将我转换为.Net 2.0,并且我拥有适当的权限,等...这个问题仍然存在.有人可以建议这是怎么回事,以及我如何使自己摆脱这种状况吗?

I have been in touch with the server folks (where I had been running the VB 2003 version w/.Net 1.0 without difficulty) and they claim that they have converted me over to .Net 2.0 and I have the proper permissions, etc. ... yet this problem persists.  Can someone suggest what may be going on here and how I might extricate myself from this situation?

另一个令人好奇的方面是:其中一个应用在< compilation>下显示了一条弯曲的蓝线.当我将鼠标悬停在该元素上时,表示< compilers>不是< compilation>的有效子元素.到底是什么呢?为什么2003到2005转换向导会创建一个无效的web.config文件?!另一个应用程序没有这个弯曲的行,但是它也具有< compilers>作为< compilation>的子元素...也有一个< assembly>元素[其他应用程序不提供] ...和三个<添加程序集...>每个指令都涉及Crystal.Decisions!我不知道那是怎么回事.

Another curious aspect of this: one of the apps has a squiggly blue line under the <compilation> element which when I hover over it says somehting to the effect that <compilers> is not a valid child element of <compilation>.  What in the world is THAT all about ... and why would the 2003-to-2005 conversion wizard create an invalid web.config file?!?  The other app does not have this squiggly line but it also has <compilers> as a child element of <compilation> ... it also has an <assemblies> element [which the other app does not] ... and three <add assembly ... > directives each of which involves Crystal.Decisions!  I don't have a clue what that's all about.

我认为我即将使这些应用程序运行,但是我可以肯定地使用一些帮助(或帮助参考)来解决这些问题.

I think I am close to getting these apps running but I could sure use some help (or references to help) for how to deal with these problems.

推荐答案

解决方案1:


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

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名称="CompilerVersion"值="v3.5"/</compiler>
.< compiler语言="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>

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

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

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

< system.web>
< trust level =完全"/>
</system.web>

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

最后,重建项目.

通过使用使用以下材料或示例代码,即表示您同意接受以下许可条款和Microsoft合作伙伴计划协议的约束,该条款的条款通过引用结合到本文中.这些许可条款是Microsoft Corporation(或根据您所在的位置,如果适用,则取决于其附属公司)与您之间的协议.我们提供给您的任何材料(示例代码除外)仅供内部使用.提供任何示例代码仅出于说明目的,并不打算在生产环境中使用.我们授予您使用,修改示例代码以及复制和分发示例代码的目标代码形式的非排他性免版税权利,但前提是您同意:(i)请勿将Microsoft的名称,徽标或商标用于销售嵌入了示例代码的您生产的软件; (ii)在嵌入了示例代码的软件产品上包括有效的版权声明; (iii)代表您的分包商并为您的利益提供免责声明,排除间接和间接损失的责任以及负责任的责任限制; (iv)赔偿,使其免受损害,并为Microsoft,其附属公司和供应商提供赔偿,使其免受使用本示例代码或由于使用本示例代码而产生的任何第三方索赔或诉讼(包括律师费)的侵害.


这篇关于信任级别不允许使用'compilerOptions'属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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