Npgsql EntityFramework,错误 - 值参数在ConnectionString中不正确 - 参数名称:app

时间:2017-11-28 13:17:17

标签: postgresql entity-framework npgsql

我希望有人可以告诉我为什么我在项目中遇到上述错误。我会尝试尽可能地包含信息。

来自我的packages.config:

<add name="aaaPGS" connectionString="metadata=res://*/aaaPGS.csdl|res://*/aaaPGS.ssdl|res://*/aaaPGS.msl;provider=Npgsql;provider connection string=&quot;port=5432;timeout=15;pooling=True;minpoolsize=1;maxpoolsize=20;commandtimeout=20;compatible=2.2.3.0;ApplicationName=aaa;host=aaaVM;database=aaaDB;user id=aaaid;password=aaapwd;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

该项目是数据库驱动的,因此我能够连接到我的PostgreSQL数据库并创建* .edmx文件,并为每个表生成相应的控制器,模型和存储库文件。通过这个过程,我有自动生成的连接字符串(&#34; aaa&#34; ==子名称):

<configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>

<entityFramework>
    <defaultConnectionFactory type="Npgsql.NpgsqlConnectionFactory, Npgsql" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
    </providers>
  </entityFramework>
  <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.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
      </dependentAssembly>    
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>

    <system.data>
    <DbProviderFactories>
        <remove invariant="Npgsql" />
        <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" support="FF" />
    </DbProviderFactories>
  </system.data>

  </runtime

在我的App.config文件中,我有以下设置:

Menu

正如你所看到我也有一个SQL连接,这个连接工作正常但是当我尝试通过postgreSQL执行相同的查询时,我得到以下错误:

&#34; ConnectionString中的值参数不正确 - 参数名称:app&#34;

我不相信连接字符串是错误的,因为它是自动生成的,但可能是我错了?是否有#34; app&#34;设置我失踪了吗?这个错误是否是其他产品的副产品?任何帮助非常感谢。

0 个答案:

没有答案