今天將微軟最新的AJaxControlTookit[40412版]下載下來進行研究,本以為很容易看到正常項目頁面。沒想到卻費了很多周折。
首先,下載後,解壓開來,運行環境一加載項目就報出錯誤:缺少AjaxMin,於是將AJaxMin4下載下來,安裝後重新加載項目,OK,一切正常。
之後編譯通過。頁面加載...
這時又出現錯誤提示:
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]
難道是'Ricciolo.VIEwStateAnalyzer.WebProfiler.VSAnalyzerHandler' 因為權限不夠,無法加載?打開項目文件web.config,一看也沒有WebProfiler啊,那它在何處?
忽然發現一行代碼:<trust level="Medium"/>,哎,不管三七二十一,先把信任等級調高一個檔次再說。將其調整至:High後,系統錯誤提示依舊,只是露出了狐狸尾巴:
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" />
而且系統錯誤文件指向系統web.config.
於是在經過查看系統程序集,確實發現有WebProfiler文件之後,最終將項目配置文件中的信任等級調至:Full。OK,問題解決。