生产System.Net.Http 4.1.1.1中的异常处理FileNotFoundException [英] Unhandeld exception in production System.Net.Http 4.1.1.1 FileNotFoundException

查看:161
本文介绍了生产System.Net.Http 4.1.1.1中的异常处理FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

This error only pops up when I publish my .Net 4.6.2 console application and install it on a remote Win 2012r2.

Onverwerkte安装:System.IO.FileNotFoundException:Kan代表程序集Sy stem.Net.Http,版本= 4.1.1.1,文化=中性,PublicKeyToken = e的b03f5f7f11d50a3a en van de afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand 尼特·文登. ---> System.IO.FileNotFoundException:看好大会System.Net .Http,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = een van d的b03f5f7f11d50a3a e afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand niet vin 巢穴 --- Einde van intern uitzonderingsstackpad --- bij Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.Initialize(IConnection 联系) bij Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.GetNegotiationRespo nse(IHttpClient httpClient,IConnection连接,String connectionData) bij Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.GetNegotiateResponse( IConnection连接,String connectionData) bij Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.Negotiate(IConnection 连接,字符串连接数据) bij Microsoft.AspNet.SignalR.Client.Connection.Negotiate(IClientTransport transpor 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)

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 systeem kan het opgegeven bestand niet vinden. ---> 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 systeem kan het opgegeven bestand niet vin den. --- Einde van intern uitzonderingsstackpad --- bij Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.Initialize(IConnection connection) bij Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.GetNegotiationRespo nse(IHttpClient httpClient, IConnection connection, String connectionData) bij Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.GetNegotiateResponse( IConnection connection, String connectionData) bij Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.Negotiate(IConnection connection, String connectionData) bij Microsoft.AspNet.SignalR.Client.Connection.Negotiate(IClientTransport transpor t) bij Microsoft.AspNet.SignalR.Client.Connection.Start(IClientTransport transport) bij Microsoft.AspNet.SignalR.Client.Connection.Start() bij CasaCommon.HouseContext..ctor() bij ConsoleApp4.Program.GetOperator() bij ConsoleApp4.Program.Main(String[] args)

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

Unfortunately I have the dutch lang pack installed. But it says: unhandled exception. Can't find file or assembly system.net.http or one of the dependencies.

我有一个带有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

I have a console app with the nuget System.Net.Http 4.3.2 (latest) but this seems to happen with something Signalr.Client related which is in my Class Lib (.Net 4.6.2) project. There is a Signalr.Client nuget 2.2.2 which depends on Microsoft.Net.Http so I did not had a nuget/ref to System.Net.Http in that class lib. Because of this error, I added the nuget for System.Net.Http 4.3.2 but that did not solve it. The error is still the same. I can't even downgrade 4.3.2 to 4.1.1.1 because there is only 4.1.1

当我降级到4.1.1时,错误仍然相同,并且已安装System.Diagnostics.DiagnosticSource.4.0.0.因此,无论我尝试什么.我一直在生产中收到此错误.在我的机器上工作... 我已经阅读了有关在解决方案资源管理器中的引用"节点中删除默认引用的内容.

When I downgraded to 4.1.1 the error is still the same and System.Diagnostics.DiagnosticSource.4.0.0 is installed. So no matter what I try. I keep getting this error in production. Works on my machine... I have read something about removing the default ref in the references node in the solution explorer. Why I can not use System.Net.Http package in a solution with System.Net.Http reference? But that did not solve it.

推荐答案

必须在控制台应用程序项目和类lib项目的app.config中对此段进行注释

Had to comment out this piece in app.config of both the console app project and the class lib project

<?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文件中.我知道我自己没有添加这些行.

It was somehow auto added to both app.config files. I know that I did not add those lines myself.

这篇关于生产System.Net.Http 4.1.1.1中的异常处理FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆