ASP.NET信任级别问题 [英] ASP.NET Trust Level Problem

查看:92
本文介绍了ASP.NET信任级别问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我已在Windows 7中设置IIS以在中等信任上运行,以模拟我的网站所在的环境主办。根据Microsoft的说法,在中等信任中,您已限制 FileIOPermission 。这似乎确实如此,因为我在 C:\ Windows \ Macrooft.NET \Framework \v4.0.30319 \Config\web_mediumtrust.config 文件中有以下条目:



Hi,

I have set up IIS in Windows 7 to run on Medium Trust, to emulate the environment where my site is hosted. According to Microsoft, in Medium Trust, you have restricted FileIOPermission. This does indeed seem to be the case because I have the following entry in my C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web_mediumtrust.config file:

<IPermission
  class="FileIOPermission"
  version="1"
  Read="$AppDir$"
  Write="$AppDir$"
  Append="$AppDir$"
  PathDiscovery="$AppDir$"
/>





我试图发现我的应用程序的根文件夹中是否存在子目录(这应该没问题,因为我有 PathDiscovery 权限),但是当我尝试以下调用时:





I am trying to discover if a sub-directory exists in my application''s root folder (which should be fine because I have PathDiscovery permission), but when I try the following call:

DirectoryInfo logFileDirectoryInfo = new DirectoryInfo( @"\logs" );





我收到一个安全例外,它只是说我没有 FileIOPermission



谁能看到我做错了什么?是否有其他方法可以检查子目录是否存在而不会导致此异常?



非常感谢任何帮助或建议。



亲切的愿望,Patrick



I get a security exception, which simply says I do not have FileIOPermission.

Can anyone see what I am doing wrong? Is there perhaps another way to check if a sub-directory exists without causing this exception?

Any help or advice would be very much appreciated.

Kind wishes, Patrick

推荐答案

AppDir



写=
" Write="


AppDir


这篇关于ASP.NET信任级别问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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