-1

This error only pops up when I publish my .Net 4.6.2 console application and install it on a remote 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 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)

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.

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

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.

JP Hellemons
  • 5,977
  • 11
  • 63
  • 128

1 Answers1

0

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>

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

JP Hellemons
  • 5,977
  • 11
  • 63
  • 128