Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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
Vb.net “无法修复错误”;无法加载System.Net.Http,版本=4.2.0.0“;_Vb.net_.net Assembly_System.net_Packages.config - Fatal编程技术网

Vb.net “无法修复错误”;无法加载System.Net.Http,版本=4.2.0.0“;

Vb.net “无法修复错误”;无法加载System.Net.Http,版本=4.2.0.0“;,vb.net,.net-assembly,system.net,packages.config,Vb.net,.net Assembly,System.net,Packages.config,在我的生产服务器上,我收到错误信息: 无法加载文件或程序集“System.Net.Http,Version=4.2.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件 在我的本地机器上,它工作正常,但在服务器上,它抛出了上述错误,因此一定是某个地方丢失了一个文件。请参阅更新3,在那里我尝试添加丢失的dll,然后抛出一个不同的错误 我遵循了这些链接中的说明: 正如在最后一个链接中所述,在我还不想迁移

在我的生产服务器上,我收到错误信息:

无法加载文件或程序集“System.Net.Http,Version=4.2.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件

在我的本地机器上,它工作正常,但在服务器上,它抛出了上述错误,因此一定是某个地方丢失了一个文件。请参阅更新3,在那里我尝试添加丢失的dll,然后抛出一个不同的错误

我遵循了这些链接中的说明:

正如在最后一个链接中所述,在我还不想迁移()的相同场景中,由于我不想遇到不兼容,我首先要解决当前的问题

我已经查找了
System.Net.Http
(和其他一些)的所有引用以及手动更改的版本号,这是我的.vbproj文件中的旧代码块:

<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
My packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.5.0.2" targetFramework="net472" />
  <package id="bootstrap" version="3.4.1" targetFramework="net472" />
  <package id="jQuery" version="3.3.1" targetFramework="net472" />
  <package id="jQuery.Validation" version="1.17.0" targetFramework="net472" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net472" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net472" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.11" targetFramework="net472" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net472" />
  <package id="Modernizr" version="2.8.3" targetFramework="net472" />
  <package id="Mollie.Net" version="2.0.2" targetFramework="net472" />
  <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
  <package id="System.IO" version="4.3.0" targetFramework="net472" />
  <package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" />
  <package id="WebGrease" version="1.6.0" targetFramework="net472" />
</packages>
首先,我将如何解决这些问题?日志说明系统找不到指定的文件,其次:我认为这与我的实际问题无关

更新3

我注意到生产服务器上的
bin
文件夹中实际上缺少
System.Net.Http.dll
。 所以我从本地机器上复制了dll。但是,我得到了一个错误:

无法加载引用程序集以执行

我检查过了,但对于像向bin文件夹添加新dll这样简单的事情来说,这似乎非常复杂。 不确定这是否重要,但我的prod服务器没有以下文件夹:C:\Program Files(x86)\Reference Assembly\Microsoft\Framework.NETFramework\v4.7.2

为什么我会犯这个错误


这并不能回答您的问题,但我很幸运地使用fuslogvw来追踪此类问题。默认情况下,它与visual studio一起安装,并记录在

一旦您运行它(它很简单,您可以将它复制到另一台机器,而无需安装任何东西),它将准确地告诉您问题发生的原因:

该工具显示有关所选绑定失败的以下详细信息:

绑定失败的具体原因,例如“未找到文件”或“版本不匹配”

有关启动绑定的应用程序的信息,包括其名称、应用程序的根目录(AppBase)以及专用搜索路径(如果有)的描述

工具正在查找的部件的标识

已应用的任何应用程序、发布者或管理员版本策略的说明

是否在全局程序集缓存中找到该程序集

所有探测URL的列表


您是否为4.7.2安装了相应的framework/developer软件包


dotnet.microsoft.com/download/dotnet-framework/net472

我知道这很旧,但今天我在一个.net 4.8项目中遇到了这个问题。我能够追踪到这个问题,对我来说,我正在通过Swashback使用Swagger。它使用WebActivatex,需要System.Net.Http v4.0.0.0,绑定将其重定向到最新版本4.2.0.0,因此这是我的修复程序。在我的web.config中。注:新版本不是最新版本,而是WebActivator Ex使用和要求的版本

  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>


谢谢!看起来是我需要的。然而,我遇到了一个问题,请参阅我的帖子中的更新1——我猜我给你的链接没有说明。记录东西——准备好所有东西来复制错误(这样你就不会得到一个巨大的日志),然后确保你以管理员的身份打开了fuslogvw,点击设置,然后“将所有绑定记录到磁盘”。一旦您这样做,复制错误,然后点击“刷新”按钮。(完成后别忘了关闭日志)这会在构建时发生吗?还是运行时?msbuild根本不应该涉及。它发生在生成时。当我在运行时进行测试时,当我单击按钮并进行重定向时(可能是由于system.net.http的问题,重定向不会发生),根本不会记录任何内容。当这种情况发生在我身上时,我从visual studio中的NuGet Package控制台窗口运行命令
Update Package-reinstall
。当库丢失、未更新、不是预期版本或与web/app.config.Shot中出现的绑定不匹配时,可能会发生这种情况,但是重新安装.net 4.7.2开发包怎么样?难以置信…不得不在prod服务器上安装4.7.2。现在它起作用了。把这个作为你的答案,我会把它标记为正确答案。谢谢
*** Assembly Binder Log Entry  (24-Aug-2019 @ 4:47:53 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = System.IO
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.IO | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/System.IO.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/System.IO/System.IO.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/System.IO.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/System.IO/System.IO.EXE.
LOG: All probing URLs attempted and failed.

*** Assembly Binder Log Entry  (24-Aug-2019 @ 4:47:53 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>