Search code examples
c#postgresqlnpgsql

C# - Postgres: I can't open connections when app is running on a shared drive


Where I work we have a maped share folder where we put our compiled application to test it as a demo. Recently my computer updated to the latest Windows 10 update and we noticed that everyone that has Windows 10 throws an exception of invalid argument when trying to open a connection. Other coworkers that have Windows 7 can run it without problems. Furthermore if I copy those file to my Documents folder, it runs without problem.

It's something related with some new Windows permissions with shared folders? The shared folder is in a Linux server.

Exception message: Se ha proporcionado un argumento no válido (An invalid argument was supplied)
Stack trace:
en Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context)
en Npgsql.NpgsqlConnector.Open()
en Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection)
en Npgsql.NpgsqlConnectorPool.RequestPooledConnectorInternal(NpgsqlConnection Connection)
en Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection Connection)
en Npgsql.NpgsqlConnection.Open()
en BRSGestion.BRSLib.BaseDatosERP_Creada(String cServidor, String cPuerto) en C:\Users\User\Documents\Visual Studio 2017\Projects\Project\....cs:línea 2341

Solution

  • If the server hosting the share is using the SMBv1 protocol, this is normal (It's a security measure).

    You'll find more informations In this thread