Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/272.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# 无法加载类型';System.Reflection.AssemblyMetadataAttribute';来自组件';mscorlib,版本=4.0.0.0_C#_Asp.net 4.0 - Fatal编程技术网

C# 无法加载类型';System.Reflection.AssemblyMetadataAttribute';来自组件';mscorlib,版本=4.0.0.0

C# 无法加载类型';System.Reflection.AssemblyMetadataAttribute';来自组件';mscorlib,版本=4.0.0.0,c#,asp.net-4.0,C#,Asp.net 4.0,我在第一次加载项目时发现此错误 Server Error in '/EasyWeb' Application. Could not load type 'System.Reflection.AssemblyMetadataAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Description: An unhandled exception

我在第一次加载项目时发现此错误

Server Error in '/EasyWeb' Application.
Could not load type 'System.Reflection.AssemblyMetadataAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
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.TypeLoadException: Could not load type 'System.Reflection.AssemblyMetadataAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Source Error:


Line 13: <body>
Line 14: <form id="form1" runat="server">
Line 15:     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
Line 16:      <Scripts>
Line 17:                <asp:ScriptReference Path="~/js/jquery-1.9.1.js" />


Source File: f:\EasyWeb\Admin\MasterPage.master    Line: 15

Stack Trace:


[TypeLoadException: Could not load type 'System.Reflection.AssemblyMetadataAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, 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 scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +115
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +426
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
   System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
   System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +388
   System.Web.UI.ScriptManager..ctor() +26
   ASP.admin_masterpage_master.__BuildControlScriptManager1() in f:\EasyWeb\Admin\MasterPage.master:15
   ASP.admin_masterpage_master.__BuildControlform1() in f:\EasyWeb\Admin\MasterPage.master:14
   ASP.admin_masterpage_master.__BuildControlTree(admin_masterpage_master __ctrl) in f:\EasyWeb\Admin\MasterPage.master:1
   ASP.admin_masterpage_master.FrameworkInitialize() in f:\EasyWeb\Admin\MasterPage.master.cs:912308
   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


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
“/EasyWeb”应用程序中出现服务器错误。 无法从程序集“mscorlib,版本=4.0.0.0,区域性=中性,PublicKeyToken=b77a5c561934e089”加载类型“System.Reflection.AssemblyMetadataAttribute”。 描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源。 异常详细信息:System.TypeLoadException:无法从程序集“mscorlib,版本=4.0.0.0,区域性=中性,PublicKeyToken=b77a5c561934e089”加载类型“System.Reflection.AssemblyMetadataAttribute”。 源错误: 第13行: 第14行: 第15行: 第16行: 第17行: 源文件:f:\EasyWeb\Admin\MasterPage.master行:15 堆栈跟踪: [TypeLoadException:无法从程序集“mscorlib,版本=4.0.0.0,区域性=中性,PublicKeyToken=b77a5c561934e089”加载类型“System.Reflection.AssemblyMetadataAttribute”。] System.ModuleHandle.ResolveType(RuntimeModule模块、Int32 typeToken、IntPtr*typeInstArgs、Int32 typeInstCount、IntPtr*methodInstArgs、Int32 methodInstCount、ObjectHandleOnStack类型)+0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule模块、Int32 typeToken、RuntimeTypeHandle[]TypeInstanceContext、RuntimeTypeHandle[]MethodInstanceContext)+180 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,类型[]genericTypeArguments,类型[]genericMethodArguments)+192 System.Reflection.CustomAttribute.FilterCustomAttributeCord(CustomAttributeRecord caRecord,MetadataImport作用域,Assembly&LastAptCookAssembly,RuntimeModule decoratedModule,MetadataToken decoratedToken,RuntimeType attributeFilterType,Boolean mustBeInheritable,Object[]属性,IList-derivedAttributes,RuntimeType和attributeType,IRontimeMethodInfo和ctor,Boolean和ctorHasParameters,Boolean和isVarArg)+115 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule、Int32 decoratedMetadataToken、Int32 pcaCount、RuntimeType attributeFilterType、Boolean mustBeInheritable、IList derivedAttributes、Boolean isDecoratedTargetSecurityTransparent)+426 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly程序集,RuntimeType caType)+103 System.Reflection.RuntimeAssembly.GetCustomAttributes(布尔继承)+33 System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(程序集)+76 System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly()+388 System.Web.UI.ScriptManager..ctor()+26 ASP.admin\U masterpage\U master.\U BuildControlScriptManager1()位于f:\EasyWeb\admin\masterpage.master:15中 f:\EasyWeb\admin\masterpage中的ASP.admin\U masterpage\U master.\UuU BuildControlform1()。master:14 ASP.admin\U masterpage\U master.\U构建控制树(admin\U masterpage\U master\U ctrl)位于f:\EasyWeb\admin\masterpage.master:1 f:\EasyWeb\admin\masterpage.master.cs:912308中的ASP.admin\U masterpage\U master.FrameworkInitialize() System.Web.UI.UserControl.InitializeAsUserControlInternal()+35 CreateMaster(TemplateControl所有者、HttpContext上下文、VirtualPath主页面文件、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(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+328 版本信息:Microsoft.NET Framework版本:4.0.30319;ASP.NET版本:4.0.30319.1 这是什么问题……这是framework 4.0 mscorlib的问题吗

这个错误让我很头疼


有人能帮我解决一下吗?…

似乎web应用程序是在安装了.NET 4.5的机器上构建的,目标框架是4.0,我认为,当应用程序在只安装了4.0的web服务器上运行时,错误通常会自动出现。这远不是理想的解决方案,但您可以在目标web服务器上安装.NET 4.5,也可以在未安装4.5的计算机上构建应用程序。visual studio 2010上的“我的应用程序”不支持.NET 4.5。是否有更好的方法绕过此错误。来自的答案可能会对您有所帮助。