aspnet / DependencyInjection

[Archived] Contains common DI abstractions that ASP.NET Core and Entity Framework Core use. Project moved to https://github.com/aspnet/Extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

未能加载文件或程序集“System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

ghd258 opened this issue · comments

未能加载文件或程序集“System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.IO.FileLoadException: 未能加载文件或程序集“System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

Took the liberty to translate this one :)

Failed to load file or assembly "System.Net.Http, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" or one of its dependencies. The assembly list definition found does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Explanation: An unhandled exception occurred during the execution of the current web request. Please check the stack trace information for more information on the error and the source of the error in the code.

Exception Details: System.IO.FileLoadException: Failed to load file or assembly "System.Net.Http, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" or one of its dependencies. The assembly list definition found does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Still you might need to provide a little more context :)

行 14: var thisAssembly = typeof(SwaggerConfig).Assembly; 行 15: 行 16: GlobalConfiguration.Configuration 行 17: .EnableSwagger(c => 行 18: {

[FileLoadException: 未能加载文件或程序集“System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]
System.Web.Http.GlobalConfiguration..cctor() +0

[TypeInitializationException: “System.Web.Http.GlobalConfiguration”的类型初始值设定项引发异常。]
System.Web.Http.GlobalConfiguration.get_Configuration() +24
VOCs.WebAPI.SwaggerConfig.Register() in J:\VOCs\03_Code\00_SourceCode\VOCsV2\06_Web\WebAPI\App_Start\SwaggerConfig.cs:16

[TargetInvocationException: 调用的目标发生了异常。]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +114
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +81
WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +699
WebActivatorEx.ActivationManager.Run() +123

[InvalidOperationException: 针对类型 WebActivatorEx.ActivationManager 的应用程序预启动初始化方法 Run 引发了异常,显示下列错误消息: 调用的目标发生了异常。。]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +902
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +169
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +173
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +912

[HttpException (0x80004005): 针对类型 WebActivatorEx.ActivationManager 的应用程序预启动初始化方法 Run 引发了异常,显示下列错误消息: 调用的目标发生了异常。。]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +534
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +718

System.Net.Http.dll 这个版本4.6.25220.1 以及以上版本无法使用 比兼容

System.Net.Http.dll 这个版本4.6.25220.1 以及以上版本无法使用 不兼容

与System.Net.Http.dll 这个版本4.6.25220.1及 以上版本不兼容,如果不引用会自动增加 System.Net.Http.dll 4.6.25514.4这个版本,但是在NuGet就没有4.6.25514.4这个版本号;引用了System.Net.Http.dll 这个版本4.6.25220.1及 以上版本会把项目的引用Dll变为感叹号

@ghd258 我能知道为什么把这个问题拿到这个repository吗?
@ghd258 May I know why posting this question here?

已解决