XML 架构导入失败,请求 System.Net.WebPermission 类型的权限
在 Visual Studio 2010 SP1 中,我打开了一个 XML 架构 (XSD) 文件,其中包含以下几行:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
xs:import
下方有一条蓝色波浪线,当您将鼠标悬停在其上方时,您会看到以下内容工具提示:
请求“System.Net.WebPermission,System,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”类型的权限失败。
我如何授予此权限以便它可以下载架构?谢谢。
更新: 我忘了在原来的帖子中提到这一点,但我已经回顾过 Craig Watson 的解决方法。它违背了 Visual Studio“自动下载 DTD 和架构”的目的(“工具”>“选项”>“文本编辑器”>“XML”>“杂项”)。我希望得到一个解决方案而不是解决方法。谢谢。
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
has a wavy blue line under it, and when you hover over it, you get the following tool tip:
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(我知道这是一个老问题。
由于没有公认的答案,我决定无论如何都添加这个答案。)这个问题的答案是这个问题的答案。
您所需要做的就是在 Windows 资源管理器中编辑文件的属性并取消阻止下载的文件。这就是导致权限异常的原因:它是一个下载的(因此不受信任的)文件。
(I know it's an old question.
Since there's no accepted answer,I've decided to add this one anyway.)This issue is answered at this question's answer.
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.
这篇文章介绍了解决方法:http://craigwatson1962.wordpress.com/2011/02/07/visual-studio-2010-xml-schema-errorsxsdimport/
不是完整的解决方案,因为您必须下载 XSD ,将其放入您的项目中,然后引用您的本地副本。
This post covers the workaround: http://craigwatson1962.wordpress.com/2011/02/07/visual-studio-2010-xml-schema-errorsxsdimport/
Not a full solution, since you have to download the XSD, put it in your project, then reference your local copy.