【发布时间】:2010-09-17 16:57:12
【问题描述】:
我们最近将网络应用从 3.5 升级到了 4.0。现在,在我登录并加载带有 Microsoft ScriptManager 的页面后,我得到:
无法加载文件或程序集“System.Windows,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。系统找不到指定的文件。
它只发生在第一次,重新加载页面,一切正常。
更新:我们有所有 Silverlight v4 项目。我在 C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0 目录中找到了 System.Windows.dll。为什么要寻找 2.0 版?
这是整个异常(编辑和删除的文件夹路径)
“/test”应用程序中的服务器错误。
无法加载文件或程序集“System.Windows,版本=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。系统找不到指定的文件。
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息: System.IO.FileNotFoundException:无法加载文件或程序集“System.Windows,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。系统找不到指定的文件。
来源错误:
第 450 行:
第 451 行:
第 452 行:
第 453 行:
第 454 行:源文件: c:{directories}\Pages\Administration\DisplayCreateEdit.aspx 行:452
程序集加载跟踪:以下信息有助于确定为什么无法加载程序集“System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e”。
警告:程序集绑定日志记录已关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。 注意:有一些与程序集绑定失败日志相关的性能损失。 要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。
堆栈跟踪:
[FileNotFoundException:无法加载文件或程序集“System.Windows,版本=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。该系统找不到指定的文件。] System.ModuleHandle.ResolveType(RuntimeModule 模块,Int32 typeToken,IntPtr* typeInstArgs,Int32 typeInstCount,IntPtr* methodInstArgs,Int32 methodInstCount,ObjectHandleOnStack 类型)+0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule 模块,Int32 typeToken,RuntimeTypeHandle[] typeInstantiationContext,RuntimeTypeHandle[] methodInstantiationContext)+180 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord,MetadataImport 范围,Assembly& lastAptcaOkAssembly,RuntimeModule decoratedModule,MetadataToken decoratedToken,RuntimeType attributeFilterType,Boolean mustBeInheritable,Object[] 属性,IListderivedAttributes,RuntimeType& attributeType,IRuntimeMethodInfo&ctor,Boolean&ctorHasParameters,Boolean& isVarArg) + 115 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule,Int32 decoratedMetadataToken,Int32 pcaCount,RuntimeType attributeFilterType,布尔 mustBeInheritable,IList derivedAttributes,布尔 isDecoratedTargetSecurityTransparent)+426 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly 程序集,RuntimeType caType) +103 System.Reflection.RuntimeAssembly.GetCustomAttributes(布尔继承)+33 System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly 程序集) +76 System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +388 System.Web.UI.ScriptManager..ctor() +26 c:{directories}\Pages\Administration\DisplayCreateEdit.aspx:452 中的 ASP.pages_administration_displaycreateedit_aspx.__BuildControlScriptManager1() ASP.pages_administration_displaycreateedit_aspx.__BuildControlContent1(Control __ctrl) 在 c:{directories}\Pages\Administration\DisplayCreateEdit.aspx:9 System.Web.UI.CompiledTemplateBuilder.InstantiateIn(控制容器)+12 System.Web.UI.MasterPage.InstantiateInContentPlaceHolder(控制 contentPlaceHolder, ITemplate 模板) +87 c:{directories}\Master.master:28 中的 ASP.master_master.__BuildControlContentPlaceHolder1() c:{directories}\Master.master:13 中的 ASP.master_master.__BuildControlmasterForm() c:{directories}\Master.master:1 中的 ASP.master_master.__BuildControlTree(master_master __ctrl) c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\zoning\dff1a5fe\99aa3a7f\App_Web_shgw15qp.4.cs:0 中的 ASP.master_master.FrameworkInitialize() System.Web.UI.UserControl.InitializeAsUserControlInternal() +35 System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8832342 System.Web.UI.Page.get_Master() +54 System.Web.UI.Page.ApplyMasterPage() +15 System.Web.UI.Page.PerformPreInit() +45 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.1
还有我们web.config的system.web:
<system.web> <pages validateRequest="false" buffer="true" theme="Summer" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"> <controls> <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/> </controls> <tagMapping> <add tagType="System.Web.UI.WebControls.TextBox" mappedTagType="CleanTextBox"/> <add tagType="System.Web.UI.HtmlControls.HtmlTextArea" mappedTagType="CleanTextArea"/> </tagMapping> </pages> <compilation debug="true" targetFramework="4.0"> <assemblies> </assemblies> </compilation> <authentication mode="Forms"> <forms requireSSL="false" cookieless="UseDeviceProfile" loginUrl="~/Pages/Authentication/Login.aspx" timeout="60" defaultUrl="~/Pages/Authentication/AccountHome.aspx" slidingExpiration="true" name="sqlAuthCookie" protection="All"/> </authentication> <sessionState timeout="60" mode="StateServer" stateConnectionString="tcpip=localhost" stateNetworkTimeout="60" cookieless="false"/> <customErrors mode="RemoteOnly" defaultRedirect="~/Pages/Global/DefaultError.aspx"> <error statusCode="404" redirect="~/Pages/Global/404.htm"/> <error statusCode="403" redirect="~/Pages/Global/403.htm"/> </customErrors> <httpHandlers> <add path="*js.axd" verb="*" type="ScriptCompressorHandler"/> <add path="*css.axd" verb="*" type="CssCompressorHandler"/> <add path="*css" verb="*" type="CssCompressorHandler"/> <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </httpHandlers> <httpModules> <remove name="WindowsAuthentication"/> <remove name="PassportAuthentication"/> <remove name="AnonymousIdentification"/> <remove name="RoleManager"/> <remove name="Profile"/> <remove name="ErrorHandlerModule"/> <add type="ScriptCompressorModule" name="ScriptCompressorModule"/> <add type="CssCompressorModule" name="CssCompressorModule"/> </httpModules> <machineKey validationKey="{key}" decryptionKey="{key}" validation="SHA1"/> <httpRuntime maxRequestLength="1048576" executionTimeout="3600" requestValidationMode="2.0"/> </system.web>See the same problem here 和 Microsoft Feedback/Bug report
编辑:我正在运行带有 IIS 5.0 的 VS 2010、XP(我每天都在工作时想念 Win 7 :-))。我们在本地 IIS 实例下运行 Web 应用程序,而不是 Cassini。我们将它部署到测试服务器,我没有看到异常。在我将 C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.windows.dll 安装到 GAC 然后将其删除并且没有看到相同的异常之后,尽管我的同事没有做到了这一点,仍然偶尔会看到它。我认为它只发生在应用程序重新启动时(每次我们在本地开发时重建应用程序时都会发生这种情况)。
【问题讨论】:
+1。你有没有解决过这个问题?我也遇到了同样的情况,但被投诉的程序集是 System.Core。我认为这与 AjaxControlToolkit 有关,因为有问题的行是<ScriptManager>控件的标记,您的堆栈跟踪中似乎也有该标记(请参阅 System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() + 388) @SirCrispalot 我们解决了这个问题,但现在已经 4 年了,我记不清了,但我认为这是 Silverlight 的参考。有没有办法摆脱 AjaxControlToolkit 并使用 jQuery UI 或其他库?
标签: asp.net-4.0