【问题标题】:Unhandeld exception in production System.Net.Http 4.1.1.1 FileNotFoundException生产 System.Net.Http 4.1.1.1 FileNotFoundException 中未处理的异常
【发布时间】:2017-08-16 07:35:25
【问题描述】:

仅当我发布我的 .Net 4.6.2 控制台应用程序并将其安装在远程 Win 2012r2 上时才会弹出此错误。

Onverwerkte uitzondering: System.IO.FileNotFoundException: Kan bestand of assembly Sy stem.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a of e en van de afhankelijkheden hiervan niet laden。 Het system kan het opgegeven bestand 聂文登---> System.IO.FileNotFoundException: Kan bestand of assembly System.Net .Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a of een van d e afhankelijkheden hiervan niet laden。 Het 系统 kan het opgegeven bestand niet vin 巢穴 --- Einde van 实习生 uitzonderingsstackpad --- bij Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.Initialize(IConnection 联系) bij Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.GetNegotiationRespo nse(IHttpClient httpClient, IConnection 连接, 字符串 connectionData) bij Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.GetNegotiateResponse( IConnection 连接,字符串连接数据) bij Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.Negotiate(IConnection 连接,字符串连接数据) bij Microsoft.AspNet.SignalR.Client.Connection.Negotiate(IClientTransport 传输 t) bij Microsoft.AspNet.SignalR.Client.Connection.Start(IClientTransport 传输) bij Microsoft.AspNet.SignalR.Client.Connection.Start() bij CasaCommon.HouseContext..ctor() bij ConsoleApp4.Program.GetOperator() bij ConsoleApp4.Program.Main(String[] args)

不幸的是,我安装了荷兰语语言包。但它说:未处理的异常。找不到文件或程序集 system.net.http 或依赖项之一。

我有一个带有 nuget System.Net.Http 4.3.2(最新)的控制台应用程序,但这似乎与 Signalr.Client 相关的东西发生在我的 Class Lib (.Net 4.6.2) 项目中。有一个 Signalr.Client nuget 2.2.2 依赖于 Microsoft.Net.Http 所以我在那个类库中没有 System.Net.Http 的 nuget/ref。由于这个错误,我为System.Net.Http 4.3.2 添加了nuget,但这并没有解决它。错误仍然相同。我什至不能将 4.3.2 降级到 4.1.1.1,因为只有 4.1.1

当我降级到 4.1.1 时,错误仍然存​​在,并且安装了 System.Diagnostics.DiagnosticSource.4.0.0。所以不管我怎么尝试。我在生产中不断收到此错误。在我的机器上工作... 我已经阅读了有关在解决方案资源管理器的引用节点中删除默认引用的内容。 Why I can not use System.Net.Http package in a solution with System.Net.Http reference? 但这并没有解决问题。

【问题讨论】:

    标签: c# nuget-package filenotfoundexception


    【解决方案1】:

    必须在控制台应用项目和类库项目的app.config中注释掉这一段

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <!--<dependentAssembly>
                    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
                    <bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
                </dependentAssembly>-->
           </assemblyBinding>
        </runtime>
    </configuration>
    

    它以某种方式自动添加到两个app.config 文件中。我知道这些行不是我自己添加的。

    【讨论】:

      猜你喜欢
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      • 2018-08-17
      • 2020-08-30
      • 2015-02-04
      • 2011-03-06
      • 1970-01-01
      • 2014-01-08
      相关资源
      最近更新 更多