调试AjaxControlTookit项目排错记录
今天将微软最新的AjaxControlTookit[40412版]下载下来进行研究,本以为很容易看到正常项目页面。没想到却费了很多周折。
首先,下载后,解压开来,运行环境一加载项目就报出错误:缺少AjaxMin,于是将AjaxMin4下载下来,安装后重新加载项目,OK,一切正常。
之后编译通过。页面加载...
这时又出现错误提示:
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Type 'Ricciolo.ViewStateAnalyzer.WebProfiler.VSAnalyzerHandler' cannot be instantiated under a partially trusted security policy (AllowPartiallyTrustedCallersAttribute is not present on the target assembly).
Source Error:
[No relevant source lines]
Source File: web.config Line: 136
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Type 'Ricciolo.ViewStateAnalyzer.WebProfiler.VSAnalyzerHandler' cannot be instantiated under a partially trusted security policy (AllowPartiallyTrustedCallersAttribute is not present on the target assembly).
Source Error:
[No relevant source lines]
Source File: web.config Line: 136
难道是'Ricciolo.ViewStateAnalyzer.WebProfiler.VSAnalyzerHandler' 因为权限不够,无法加载?打开项目文件web.config,一看也没有WebProfiler啊,那它在何处?
忽然发现一行代码:<trust level="Medium"/>,哎,不管三七二十一,先把信任等级调高一个档次再说。将其调整至:High后,系统错误提示依旧,只是露出了狐狸尾巴:
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
Line 134: <add path="*.xoml" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
Line 135: validate="false" />
Line 136: <add path="*.vsax" verb="*" type="Ricciolo.ViewStateAnalyzer.WebProfiler.VSAnalyzerHandler, Ricciolo.ViewStateAnalyzer.WebProfiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0368bc80d1228e85" />
Line 137: <add path="trace.axd" verb="*" type="System.Web.Handlers.TraceHandler"
Line 138: validate="true" />
Line 135: validate="false" />
Line 136: <add path="*.vsax" verb="*" type="Ricciolo.ViewStateAnalyzer.WebProfiler.VSAnalyzerHandler, Ricciolo.ViewStateAnalyzer.WebProfiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0368bc80d1228e85" />
Line 137: <add path="trace.axd" verb="*" type="System.Web.Handlers.TraceHandler"
Line 138: validate="true" />
而且系统错误文件指向系统web.config.
于是在经过查看系统程序集,确实发现有WebProfiler文件之后,最终将项目配置文件中的信任等级调至:Full。OK,问题解决。