首页 文章

无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0

提问于
浏览
1

我最近在VS 2017上的WebAPI项目中开始出现此错误 . 如果我在另一台机器上运行相同的项目,它可以正常工作 . 我尝试重新安装VS 2017,重新安装.net 4.0和4.5 . 我也尝试将项目目标更改为4.7,其中没有任何工作 . 这是一个类似的问题,但我没有运行.net core 2.0(ASP.NET Core 2.0 Could not load file or assembly System.ServiceModel)任何帮助将不胜感激 .

我也尝试将此DLL添加到项目中并通过webconfig添加它但没有更改任何内容 .

DLL在我的系统上 - > C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ System.ServiceModel.dll

无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一 . 该模块应该包含一个程序集清单 . 描述:执行当前Web请求期间发生未处理的异常 . 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息 . 异常详细信息:System.BadImageFormatException:无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一 . 该模块应该包含一个程序集清单 . 源错误:在执行当前Web请求期间生成了未处理的异常 . 可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息 . 程序集加载跟踪:以下信息有助于确定无法加载程序集“System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089”的原因 . 程序集管理器从以下位置加载:C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ clr.dll在可执行文件C:\ Program Files(x86)\ IIS Express \ iisexpress.exe下运行---下面是详细的错误日志 . ===预绑定状态信息===日志:DisplayName = System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089(完全指定)LOG:Appbase = file:/// C:/ Users / Michael / Desktop / Project / API / LOG:Initial PrivatePath = C:\ Users \ Michael \ Desktop \ Project \ API \ bin调用程序集:(未知) . ===日志:此绑定在默认加载上下文中启动 . 日志:使用应用程序配置文件:C:\ Users \ Michael \ Desktop \ Project \ API \ web.config日志:使用主机配置文件:C:\ Users \ Michael \ Documents \ IISExpress \ config \ aspnet.config日志:使用机器来自C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config的配置文件 . 日志:后策略引用:System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089堆栈跟踪:[BadImageFormatException:无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0,Culture = neutral ,PublicKeyToken = b77a5c561934e089'或其依赖项之一 . 该模块应该包含一个程序集清单 . ] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)0 System.Reflection .RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)36 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,RuntimeAssembly reqAssembly, StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)152 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,Sta ckCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean forIntrospection)77 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackMark,Boolean forIntrospection)21 System.Reflection.Assembly.Load(String assemblyString)28 System.Web.Configuration.CompilationSection .LoadAssemblyHelper(String assemblyName,Boolean starDirective)38 [ConfigurationErrorsException:无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一 . 该模块应该包含一个程序集清单 . ] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)738 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)57 System.Web.Compilation.BuildManager.GetReferencedAssemblies (CompilationSection compConfig)170 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()92 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath,Boolean&isRefAssemblyLoaded)290 System.Web.Compilation.BuildManager.ExecutePreAppStart()157 System.Web . Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)549 [HttpException(0x80004005):无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0,Culture =中性,Pu blicKeyToken = b77a5c561934e089'或其依赖项之一 . 该模块应该包含一个程序集清单 . ] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)10042604 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)254

1 回答

  • 1

    我最终从朋友的计算机上复制了“C:\ Windows \ Microsoft.NET”目录,之后它运行良好 . 很奇怪 .

相关问题