All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
delphi工程选项及桌面配置文件(.dof)
VC#2005快速入门之复合赋值操作符_[Asp.Net教程]
ASP.NET用Repeater控件显示数据_[Asp.Net教程]
php——array,数组学习整理_php资料_编程技术
C#教程:C#数据类型之值的类型
ASP.NET定制错误处理页面_[Asp.Net教程]
js也可以有自定义事件,注入就是这么爽_.net资料_编程技术
ASP.NET中绑定枚举类型_.net资料_编程技术
用php简单实现Search Engine Friendly的URL_[PHP教程]
用CommandBehavior自动关闭与之相关联的conn_[Asp.Net教程]
Reading number is top 10 pictures
这才叫绝色美女1
Breasts woman big set 2
Average female college students1
泳装名模阿尔贝特妮写真
Players in the eyes of a perfect love1
yy365网站上的美女2
The mother was a stay-at-home children too tired took three baby suicide
Female model behind the bitterness, often being overcharged3
含苞欲放的素颜美少女1
小学生作文又现神作,你不得不佩服
Download software ranking
XML+Web+Service开发教程
dreamweaver8中文版
Boxer Classic video3
Jinling thirteen stock
Tram sex maniac 2 (H) rar bag3
Desire a peach blossom
在线棋牌游戏3.05版
Unix video tutorial6
C语言教程TXT
White deer villiage
delv published in(发表于) 2014/1/8 7:04:28 Edit(编辑)
虚拟主机上asp.net运行权限不足问题及解决_[Asp.Net教程]

虚拟主机上asp.net运行权限不足问题及解决_[Asp.Net教程]

虚拟主机上asp.net运行权限不足问题及解决_[Asp.Net教程]

有些时候我们写的asp.net应用程序是运行在虚拟主机上。有一些虚拟主机可能是由于安全的考虑,对asp.net做了权限设置,会导致我们的应用程序无法正常运行。

问题现象:
由于某种原因,asp.net不能加载某些dll文件,出现如下错误提示: Server Error in '/' Application.
---------------------------------------------


Required permissions cannot be acquired.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.


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:



[PolicyException: Required permissions cannot be acquired.]
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2738293
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57


[FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32


  问题分析:


根据我的观察,asp.net应用程序直接生成的dll可以正常加载,由asp.net直接调用的外部dll也可以正常加载,但是仅被外部dll引用的其他外部dll不能加载。我的猜想是:由于权限是不完全的,asp.net应用本身生成的dll和直接引用的dll可以通过权限的继承获得权限,而仅被外部dll引用的其他外部dll因为权限的限制不能继承权限,因此出现了权限不足的问题。


  问题解决:


通过在我电脑的试验,推测虚拟主机上修改了根web.config(在我电脑上其位置为C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG)的设置.
默认web.config的权限设置节如下:




















推测虚拟主机上修改之后的设置:




















他首先设置了allowOverride为false,这就阻止了在用户web.config中重新定义权限的能力。然后,他定义trust level为High,而不是默认的Full。经我测试,只要trust level不为Full,仅被外部dll引用的其他外部dll就不能被加载。 因此,我建议技术支持将allowOverride节设置为true。这样我就可以在web.config中重新指定权限了。


例:


最近已经不研究aps.net了,因此也没有认真去查找深层的原因,或许我的认识还有误。希望那位高手可以道出深层的原因,或指正我的错误。


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.