XML模式导入失败,请求类型为System.Net.WebPermission的许可 [英] XML Schema import fails with Request for the permission of type System.Net.WebPermission

查看:168
本文介绍了XML模式导入失败,请求类型为System.Net.WebPermission的许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2010 SP1中,我打开了带有以下几行的XML架构(XSD)文件:

In Visual Studio 2010 SP1, I have an XML Schema (XSD) file open with the following lines:

<xs:import namespace="http://www.w3.org/XML/1998/namespace"
           schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>

xs:import下有一条蓝色波浪线,将鼠标悬停在其上时,会显示以下工具提示:

xs:import has a wavy blue line under it, and when you hover over it, you get the following tool tip:

请求类型为'System.Net.WebPermission,System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败.

Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

如何授予此权限,以便它可以下载架构?谢谢.

How do I grant this permission so it can download the schema? Thanks.

更新: 我忘记在原始帖子中提及此内容,但是我已经查看过克雷格·沃森(Craig Watson)的解决方法.它违反了使Visual Studio自动下载DTD和模式"的目的(工具>选项>文本编辑器> XML>其他).我希望找到一种解决方案,而不是一种解决方法.谢谢.

Update: I forgot to mention this in my original post, but I've already reviewed Craig Watson's workaround. It defeats the purpose of having Visual Studio "automatically download DTDs and schemas" (Tools > Options > Text Editor > XML > Miscellaneous). I'm hoping for a solution rather than a workaround. Thanks.

推荐答案

(我知道这是一个老问题.由于没有可接受的答案,我决定还是添加一个.)

(I know it's an old question. Since there's no accepted answer, I've decided to add this one anyway.)

此问题的答案位于此问题的答案.

您需要做的就是在Windows资源管理器中编辑文件的属性,然后取消阻止下载的文件.这就是导致权限异常的原因:它是一个已下载(因此不受信任)的文件.

All you need to do is edit the file's properties in Windows Explorer and unblock the downloaded file. That's what's causing the permissions exception: it's a downloaded (and thus untrusted) file.

这篇关于XML模式导入失败,请求类型为System.Net.WebPermission的许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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