在ASP.NET安全例外和加载用户配置文件选项在IIS 7.5 [英] Security exceptions in ASP.NET and Load User Profile option in IIS 7.5

查看:2182
本文介绍了在ASP.NET安全例外和加载用户配置文件选项在IIS 7.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的ASP.NET 2.0应用程序的新版本部署后,它开始提高安全性异常:System.Security.SecurityException:类型System.Web.AspNetHostingPermission,系统,版本= 2.0.0.0'的许可请求文化=中性公钥= b77a5c561934e089'失败。

After deployment of new version of our ASP.NET 2.0 application, it started to raise security exception: „System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.".

互联网上快速研究后,我们能够在IIS 7.5应用程序池设置加载用户配置文件,以真正解决这个ISSE。该解决方案还是在计算器多次提到这里:

After quick research on internet we were able to resolve this isse by setting „Load User Profile" to True in IIS 7.5 application pool. This solution is also mentioned several times here on stackoverflow:

但是,我们无法找到原因,它必须是真实的。我们回顾了新版本的所有变化(很高兴有只有几个),但没有发现任何可疑的东西(没有访问注册表或临时数据如一些文章建议等)。任何人可以给我们当在IIS中承载的ASP.NET应用程序7.5需求加载用户配置文件选项设置为True提示?

However we were unable to find reason why it has to be true. We reviewed all changes in new version (gladly there were only a few), but didn’t find anything suspicious (no access to registry or temp data as some articles suggested etc). Could anybody give us hints when an ASP.NET application hosted in IIS 7.5 needs „Load User Profile" option set to True?

详细内容:


  • 应用程序池:.NET 2.0;托管管道模式 - 经典;身份 - 自定义的域帐户

  • 在IIS 6.0(W2K3):新旧
    应用做工精细版本

  • 在IIS 7.5(W2K8-R2):老版
    应用程序工作正常;新版本
    应用安全性提高
    例外 - 它开始工作后,
    加载用户配置文件设置为True

感谢您!

编辑:
我们终于找到了这个问题的原因!我们的管理使用不同的技术来应用的新版本从分段环境到生产环境复制。他用的Web服务器作为中介。 donwloading压缩发布版本的文物到生产环境,然后解压缩文件后,他们仍然标注为封杀,因为他们来自不同的计算机来了。参见<一个href=\"http://superuser.com/questions/38476/this-file-came-from-another-computer-how-can-i-unblock-all-the-files-in-a\">http://superuser.com/questions/38476/this-file-came-from-another-computer-how-can-i-unblock-all-the-files-in-a. ASP.NET那么在逻辑执行在部分信任,而不是完全信任这些二进制文件,并且实际上导致我们的申请中提到的安全异常

设置加载用户配置文件,以真正的固定安全例外的副作用。如果加载用户配置文件设置为False,那么我们的应用程序(不是我们的code,也许有些.NET基础类库或外部组件)试图查询有关目录C基本信息:\\ WINDOWS \\ system32 \\设置\\ systemprofile

Setting "Load User Profile" to True fixed the security exceptions as a side-effect. If "Load User Profile" is set to False, then our application (not our code, maybe some .NET BCL or external assembly) is trying to query basic info about directory "C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files" which the identity of application pool is not allowed to:


  • 以完全信任:拒绝访问该查询操作不会引发任何异常

  • 在部分信任:拒绝访问该查询操作引发安全异常

应用程序池启动时如果加载用户配置文件设置为True,则临时配置文件中的用户目录中创建每次。然后,我们的应用程序试图查询有关该个人的Internet临时文件目录,其中应用程序池的身份被允许的信息。因此,没有例外,甚至有部分信任提升。

If "Load User Profile" is set to True, then temporary profile in Users directory is created every time when application pool starts. Our application is then trying to query info about "Temporary Internet Files" directory of this profile, which the identity of application pool is allowed to. Thus no exception is raised even with partial trust.

真的很好疑难解答会话! :)

Really nice troubleshooting session! :)

推荐答案

再举一个例子,当加载用户配置文件设置可能会帮助你的是临时文件的使用情况。有时这usege可以是间接的。例如SQL防爆preSS能够在某些情况下做到这一点。

One more example when "Load User Profile" setting could helps you is usage of temporary files. Sometime this usege can be indirect. SQL Express for example can do this in some situations.

所以我的建议。关闭加载用户配置文件,并检查%TEMP%。然后试着给用于应用程序池的完全访问域帐户(或更改访问),从%TEMP%目录。也许这解决您的问题。

So my advice. Switch off "Load User Profile" and examine %TEMP%. Then try to give domain account used for application pool the full access (or change access) to the directory from %TEMP%. Probably it fix your problem.

还有一个建议是过程监控的使用(请参阅http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx)以语言环境将用于用户配置文件的零件(或收到拒绝访问错误),当您收到的时刻。System.Security.SecurityException:请求类型'System.Web.AspNetHostingPermission许可异常

One more advice is usage of Process Monitor (see http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) to locale which parts of user profile will be used (or receive "access denied" error) at the moment when you receive "System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission" exception.

这篇关于在ASP.NET安全例外和加载用户配置文件选项在IIS 7.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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