none
DbProviderFactories duplicate entry? RRS feed

  • Question

  • Hello all, and sorry for my english:

    I have this error with my exe application: "DbProviderFactories section only can appear once time in the config file".

    Searching in forums always the same response: "see your machine.config file"; but in the machine.config file have no duplicate entries and i don't find response.

    One more thing. This only occurs whith release executable file. Debug executable file works fine.

    Do I need rebote my machine? What happen? What can I do?

    Anyone could help me, please.

    Best regards from Spain.

    Thursday, November 24, 2011 6:28 PM

Answers

  • Problem solved:

    Very important, consider if your machines works in 32 or 64 bits. When see the machine.config files, this could be in this folders:

    In 32bit systems:

    - C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

    - C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

    In 64bit systems:

    - C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG

    - C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

    My error, only see the files for 32bit.

    Thanks a lot all!!!

    • Marked as answer by aguilandero Friday, November 25, 2011 8:49 AM
    Friday, November 25, 2011 8:49 AM

All replies

  • What does your app.config look like?
    Please mark as answer, if this was it. Visit my SQL Server Compact blog
    Thursday, November 24, 2011 8:38 PM
  • Hello anguilandero,

    The problem may lie in your Release.web.config transform file as you mentioned that it works normally in Debug mode.  You may need to change it to xdt:Transform="Replace" so that you don't get the extra one.

    It would be easy to check if you go to your web.config in release form, you should clearly see multiple entries as ErikEJ hinted.

    Edit: I re-read that you said your executable file.  You can disregard what I wrote if you aren't using a web application.
    • Edited by Scotty_ Thursday, November 24, 2011 9:47 PM Added Edit
    Thursday, November 24, 2011 9:41 PM
  • This is my app.config file.

    It hasn't duplicate entries for dbproviderfactories:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <configSections>
            <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
                <section name="Animalario.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
            </sectionGroup>
        </configSections>
        <connectionStrings>
            <add name="AnimalarioContext" connectionString="initial catalog=localhost:C:\\proyecto\\BD\\Animalario\\AnimalarioFB25.gldb;data source=localhost;max pool size=100; Connection Timeout=240;User=SYSDBA;Password=masterkey;" providerName="FirebirdSql.Data.FirebirdClient"/>
        </connectionStrings>
        <system.data>
            <DbProviderFactories>
                <remove invariant="FirebirdSql.Data.FirebirdClient" />
                <add name="Firebird" invariant="FirebirdSql.Data.FirebirdClient"
                 description="Firebird"
                 type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
            </DbProviderFactories>
        </system.data>
        <applicationSettings>
            <Animalario.Properties.Settings>
                <setting name="SessionTime" serializeAs="String">
                    <value>30</value>
                </setting>
                <setting name="ProviderDB" serializeAs="String">
                    <value>Firebird</value>
                </setting>
                <setting name="ServidorDocumentos" serializeAs="String">
                    <value>localhost:8094</value>
                </setting>
                <setting name="CarpetaLog" serializeAs="String">
                    <value>c:\\WebPruebas\\Log\\Animalario\\</value>
                </setting>
                <setting name="TipoAplicacion" serializeAs="String">
                    <value>2</value>
                </setting>
                <setting name="ServicioAnimalario" serializeAs="String">
                    <value>localhost:8100</value>
                </setting>
                <setting name="cns" serializeAs="String">
                    <value>initial catalog=C:\\proyecto\\BD\\Animalario\\AnimalarioFB25.gldb;data source=localhost;max pool size=100; Connection Timeout=240;User={0};Password={1}</value>
                </setting>
            </Animalario.Properties.Settings>
        </applicationSettings>
    </configuration>

     

    Friday, November 25, 2011 7:20 AM
  • Problem solved:

    Very important, consider if your machines works in 32 or 64 bits. When see the machine.config files, this could be in this folders:

    In 32bit systems:

    - C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

    - C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

    In 64bit systems:

    - C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG

    - C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

    My error, only see the files for 32bit.

    Thanks a lot all!!!

    • Marked as answer by aguilandero Friday, November 25, 2011 8:49 AM
    Friday, November 25, 2011 8:49 AM