Docker and System.Net.Http

On my developing machine the installer for Docker for Windows hangs forever. The problem occur from stable version 2.1.0.1 to 2.1.0.5. After a little inspection, i discovered that the installer is waiting for the “Docker Desktop Service”. The log for the service show the error:

…cannot load assembly ‘System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ …

For the library System.Net.Http there are some version problem. If you take this library from Net Framework 4.6.2 (the framework used by Docker for Windows) this library have the Version=4.2.0.0. If you get this library from Nuget you get a library with version <4.2.0.0 (see this for details). So how to solve?

While the installer still hang, waiting for the service to start, follow this steps:

  • go to C:\Program Files\Docker\Docker
  • open the file com.docker.service.config
  • comment out or delete the part:

<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.2.0.0" newVersion="4.2.0.0" />      </dependentAssembly>    </assemblyBinding>

  • go to Service Console and start the service “com.docker.service” or “Docker Desktop Service” (the name depend on version)

When the service start the installer complete succesfully. Close the installer. The Docker Service Client also do not start for the same reason, the solution is the same, comment out the same binding redirect in the file Docker Desktop.exe.config.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.