These were the steps that resolved it for me:
(1) add DbFactory provider to machine.config file located in the .NET Microsoft Frameworking folder
(2) register npgsql.dll and mono.security.dll in GAC using gacutil
Step by step details for:
(1) add DbFactory provider to machine.config
a. go to your relevant NET framework config directory (e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config)
b. edit the machine.config file and add the below line to DbProviderFactories
<DbProviderFactories>
<add name="Npgsql Data Provider"
invariant="Npgsql"
support="FF"
description=".Net Framework Data Provider for Postgresql Server"
type="Npgsql.NpgsqlFactory, Npgsql"/>
</DbProviderFactories>
(2) register npgsql.dll and mono.security.dll in GAC
a. check if npgsql and mono.security is in GAC folder
(my GAC folder was located at C:\Windows\Microsoft.NET\assembly\GAC_MSIL)
If not, then use gacutil to install npgsql to GAC in command prompt using gacutil /i npgsql.dll