zoukankan      html  css  js  c++  java
  • LicenseContext.GetSavedLicenseKey 需要 FileIOPermission

    当ASP.NET 运行于 Medium Trust 环境下,有两种情况:

    Context.GetSavedLicenseKey(type, null), 会有SecurityException 抛出,提示需要FileIOPermission;

    Context.GetSavedLicenseKey(type, assembly), 但assembly不为null时,可以正常使用。

    怎样得到assembly, 大部分的时候都是通过Assembly.GetEntryAssembly() 获得。在ASP.NET环境下,Entry Assembly 一直是null.

    怎么办?可以在AppDomain.CurrentDomain.GetAssemblies() 中搜索含有 xxx.licenses资源的assembly

    有关于Medium Trust的描述可以参考:

    Medium Trust Summary

    The main constraints placed on medium trust Web applications are:

    • OleDbPermission is not available. This means you cannot use the ADO.NET managed OLE DB data provider to access databases. However, you can use the managed SQL Server provider to access SQL Server databases.
    • EventLogPermission is not available. This means you cannot access the Windows event log.
    • ReflectionPermission is not available. This means you cannot use reflection.
    • RegistryPermission is not available. This means you cannot access the registry.
    • WebPermission is restricted. This means your application can only communicate with an address or range of addresses that you define in the <trust> element.
    • FileIOPermission is restricted. This means you can only access files in your application's virtual directory hierarchy. Your application is granted Read, Write, Append, and PathDiscovery permissions for your application's virtual directory hierarchy.

    You are also prevented from calling unmanaged code or from using Enterprise Services.

    http://msdn.microsoft.com/en-us/library/ff648344.aspx

  • 相关阅读:
    Jersey初始化配置
    Jersey框架简介
    警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:esignmanage' did not find a matching property.解决
    HIbernate基于外键的查询
    Apache Maven 入门篇(下)
    Apache Maven 入门篇 ( 上 )
    DetachedCriteria用法
    SQL Excel导入到sqlserver表
    轮番图片js
    Js Tab页(二)
  • 原文地址:https://www.cnblogs.com/xixifusigao/p/2250002.html
Copyright © 2011-2022 走看看