System.Security.SecurityException? [英] System.Security.SecurityException?

查看:85
本文介绍了System.Security.SecurityException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说明:应用程序尝试执行安全策略不允许的操作.要授予此应用程序所需的权限,请联系您的系统管理员或在配置文件中更改应用程序的信任级别.

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.

异常详细信息:System.Security.SecurityException:请求类型为"System.Security.Permissions.FileIOPermission,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089"的权限失败.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

我的代码在我的本地服务器上运行正常,将其上传到服务器时出现了问题.

My code runs proper in my local server it's create issue when upload it to server.

已通过以下代码,但对我而言不起作用:

Have gone through following code but it's not working for me :

示例1:

<system.web>
  <securityPolicy>
    <trustLevel name="Full" policyFile="internal"/>
  </securityPolicy>
</system.web>

示例2:

<location allowOverride="false">
  <system.web>
    <securityPolicy>
      <trustLevel name="Full" policyFile="internal" />
      <trustLevel name="High" policyFile="web_hightrust.config" />
      <trustLevel name="Medium" policyFile="web_mediumtrust.config" />
      <trustLevel name="Low"  policyFile="web_lowtrust.config" />
      <trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
    </securityPolicy>
  </system.web>
</location>

示例3:

<system.web>
    <trust level="Full" originUrl="" />
</system.web>

我无法访问IIS,我只有FTP详细信息可以上传文件.请建议我从webconfig文件中解决该问题的选项.

I can't able to access IIS I have only FTP details to upload file. Please suggest me option to solve it from webconfig file.

推荐答案

示例3中使用的方法与我的解决方案相似,但是我没有添加您拥有的其他属性.尝试这种简单的方法.

The approach you used in sample three is similar to my solution, but I did not add the additional attribute that you had. Try this simple approach.

  <system.web>
    <trust level="Full"/>
  </system.web>

这来自 MSDN发布我读过.

这篇关于System.Security.SecurityException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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