我有一个简单的Web应用程序,在默认的“完全”信任级别下可以正常工作。 然后我发现我的主机工作在“中级”信任级别,并且不可更改, 无论如何,我必须以中等信任度工作。
但是当我在web.config中更改“信任”级别时,我有“无法获得执行权限。” 错误。
Execution permission 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: Execution
permission 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: Execution permission cannot be acquired.]
System.Security.CodeAccessSecurityEngine.TryResolveGrantSet(Evidence
evidence, PermissionSet& grantSet) +12663032
System.Security.CodeAccessSecurityEngine.ResolveGrantSet(Evidence
evidence, Int32& specialFlags, Boolean checkExecutionPermission) +44
....
网络配置为:
<?xml version="1.0"?>
<configuration>
<system.web>
<globalization fileEncoding="utf-8" requestEncoding="utf-8"
responseEncoding="utf-8" culture="en-US" uiCulture="es-ES"/>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
<trust level="Medium" originUrl=""/>
</system.web>
</configuration>
此外,我没有使用任何一个
我的项目只有2个类和一些.aspx网页。 要在“中等信任度”中工作,我必须做些什么更改?