SecurityException:请求 AspNetHostingPermission 类型的权限失败
设置新的开发工作站时,当我从 Visual Studio 2008 运行 ASP.NET (MVC) 应用程序时,出现 SecurityException。任何想法可能是什么问题?
我正在通过 SMB 访问数据文件(它是作为 Z: 装载的共享),并且我通过运行完全信任它
caspol -m -ag 1 -url "\\server\share\" FullTrust -exclusive on
完整的回溯是:
“/”应用程序中的服务器错误。
安全异常
描述:应用程序试图执行不允许的操作 安全政策。授予此应用程序所需的权限 请联系您的系统管理员或更改 配置文件中应用程序的信任级别。
异常详细信息:
系统.安全.安全异常: 请求类型为“System.Web.AspNetHostingPermission”的权限, 系统,版本=2.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089'失败。来源错误:
当前执行过程中产生了未处理的异常 网络请求。有关异常的起源和位置的信息 可以使用下面的异常堆栈跟踪来识别。
堆栈跟踪:
[SecurityException:请求类型的权限 'System.Web.AspNetHostingPermission,系统,版本=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 失败。]
System.Reflection.Assembly._GetType(字符串名称,布尔值 throwOnError,布尔值 忽略大小写)+0
System.Reflection.Assembly.GetType(字符串名称,布尔值 throwOnError,布尔值 忽略大小写)+42
System.Web.UI.Util.GetTypeFromAssemblies(ICollection 程序集、字符串类型名称、布尔忽略大小写)+145
System.Web.UI.TemplateParser.GetType(字符串 类型名称、布尔值忽略大小写、布尔值 throwOnError) +73
System.Web.UI.TemplateParser.ProcessInheritsAttribute(字符串 基本类型名称,字符串代码文件基本类型名称,字符串src, 组装组装)+111
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary 解析数据)+279版本信息: Microsoft .NET 框架版本:2.0.50727.4927; ASP.NET版本:2.0.50727.4927
Setting up a new developing workstation, when I run the ASP.NET (MVC) application from Visual Studio 2008 I get a SecurityException. Any ideas what might be the problem?
I am accessing the data files over SMB (it's a shared mounted as Z:) and I've given full trust to it by running
caspol -m -ag 1 -url "\\server\share\" FullTrust -exclusive on
The full traceback is:
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by
the security policy. To grant this application the required permission
please contact your system administrator or change the
application's trust level in the configuration file.Exception Details:
System.Security.SecurityException:
Request for the permission of type 'System.Web.AspNetHostingPermission,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.Stack Trace:
[SecurityException: Request for the permission of type
'System.Web.AspNetHostingPermission, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean
ignoreCase) +0
System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean
ignoreCase) +42
System.Web.UI.Util.GetTypeFromAssemblies(ICollection
assemblies, String typeName, Boolean ignoreCase) +145
System.Web.UI.TemplateParser.GetType(String
typeName, Boolean ignoreCase, Boolean throwOnError) +73
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String
baseTypeName, String codeFileBaseTypeName, String src,
Assembly assembly) +111
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary
parseData) +279Version Information: Microsoft .NET
Framework Version:2.0.50727.4927;
ASP.NET Version:2.0.50727.4927
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否使用指向远程共享的虚拟目录?
http://support.microsoft.com/?id=320268
另请查看“对 ASP.NET 中的常见权限和安全相关问题进行故障排除”
http://support.microsoft.com/?id=910449
Are you using a virtual directory that points to a remote share?
http://support.microsoft.com/?id=320268
Also take a look at "Troubleshooting common permissions and security-related issues in ASP.NET"
http://support.microsoft.com/?id=910449
这是一个对我有用的命令:
Here's a command which worked for me: