Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将应用程序转换为在中等信任级别下运行?_C#_.net_Asp.net_Visual Studio_.net 3.5 - Fatal编程技术网

C# 如何将应用程序转换为在中等信任级别下运行?

C# 如何将应用程序转换为在中等信任级别下运行?,c#,.net,asp.net,visual-studio,.net-3.5,C#,.net,Asp.net,Visual Studio,.net 3.5,我的web应用程序由几个Visual Studio项目组成。它当前在高信任级别()下运行良好。当我尝试在中等信任级别下运行它时,出现以下错误: 安全例外 描述:应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改应用程序的信任级别 异常详细信息:System.Security.Security 异常:请求失败 源错误: 在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别 堆栈跟踪: [Sec

我的web应用程序由几个Visual Studio项目组成。它当前在高信任级别(
)下运行良好。当我尝试在中等信任级别下运行它时,出现以下错误:

安全例外

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

异常详细信息:System.Security.Security
异常:请求失败

源错误:

在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别

堆栈跟踪:

[SecurityException: Request failed.]
System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark stackMark, Boolean loadTypeFromPartialName) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark stackMark) +64   
System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark stackMark) +58   
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65   
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +342   
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +52
版本信息:Microsoft.NET Framework版本:2.0.50727.4952;ASP.NET版本:2.0.50727.4955


识别问题并将应用程序转换为在中等信任环境下正常运行的最佳方法是什么?

看起来您已经有了一些动态配置解决方案-您是否在web.Config中定义了一些自定义配置组-反射是中等信任环境中首先关闭的事项之一,大多数主持人都会把它关掉

如果是这样的话,如果可能的话,我建议继续创建一个显式处理程序