.NET 4的奇怪异常-名称空间'System.Security'中不存在'SecurityRulesAttribute' [英] Strange exception with .NET 4 - 'SecurityRulesAttribute' does not exist in the namespace 'System.Security'

查看:115
本文介绍了.NET 4的奇怪异常-名称空间'System.Security'中不存在'SecurityRulesAttribute'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Server 2008中带有IIS的ASP.NET 4.0站点上,我得到一个非常奇怪的异常-

 

The type or namespace name 'SecurityRulesAttribute' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) 

 

堆栈跟踪没有提供任何有用的信息:

 

[XslLoadException:类型或名称空间名称'SecurityRulesAttribute'在名称空间'System.Security中不存在. '(您是否缺少装配参考?)

   System.Xml.Xsl.XslCompiledTransform.LoadInternal(对象样式表,XsltSettings设置,XmlResolver样式表Resolver)+1226517

 

当我尝试执行XSL转换(使用XslCompiledTransform)时会发生这种情况: >

 

 

xslt.Load(xslStreamDoc, settings, new XmlUrlResolver());

 

我检查了程序集引用,它们都指向4.0(System.Xml,mscorlib等. ).我验证了mscorlib 4.0中存在SecurityRulesAttribute类.奇怪的事情 的问题是,如果我在VS 2010中使用ASP.NET开发服务器运行网站,则不会发生此问题.

 

除上述XSLT之外,该站点在IIS中均可正常运行.有什么想法吗?

 

解决方案

您是否完全确定该ASP应用程序配置为运行4.0? >

I get a very strange exception on a ASP.NET 4.0 site with IIS in Windows Server 2008 -

 

The type or namespace name 'SecurityRulesAttribute' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) 

 

The stack trace doesn't give any useful information:

 

[XslLoadException: The type or namespace name 'SecurityRulesAttribute' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)]

   System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) +1226517

 

It happens when I try to do a XSL Transformation (using XslCompiledTransform):

 

 

xslt.Load(xslStreamDoc, settings, new XmlUrlResolver());

 

I checked the assembly references and they are all pointing to 4.0 (System.Xml, mscorlib, etc.). I verified that the SecurityRulesAttribute class exists in mscorlib 4.0. The weird thing is that the problem does not happen if I run the web site using the ASP.NET Development server in VS 2010.

 

The site runs fine in IIS with the exception of the above XSLT. Any ideas?

 

解决方案

Are you absolutely sure that this ASP app is configured to run with 4.0? 


这篇关于.NET 4的奇怪异常-名称空间'System.Security'中不存在'SecurityRulesAttribute'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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