Npgsql: Could not load file or assembly 'System.Net.Sockets, Version=4.2.0.0' on IIS

0

My Web API is running on IIS 8.5 with .NET 4.6.1 installed. I added a new controller that connects to PostgreSQL database using Npgsql NuGet package.

Now I'm getting an exception on every request to that controller in production (on my local machine everything works as expected):

Could not load file or assembly 'System.Net.Sockets, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.Net.Sockets, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Npgsql.NpgsqlConnector.d__154.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Npgsql.NpgsqlConnector.ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationToken) at Npgsql.NpgsqlConnector.d__152.MoveNext()

I changed Enable 32-Bit Applications to true in the application pool, but that did not solve the problem.

I'm using Visual Studio 2015.

UPDATE

If I add System.Net.Sockets but not version 4.2.0.0 I get an exception:

Could not load file or assembly 'System.Net.Sockets, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

c#
visual-studio
asynchronous
iis
npgsql
asked on Stack Overflow Dec 19, 2019 by FIL • edited Dec 20, 2019 by FIL

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0